magento / magento/magento-cloud-docker

PHP CLI image instruction adding crontab entry cannot succeed

Open
#341 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Progress: ready for grooming
Dominant language
PHP
Stars
277
Forks
187
PR merge metrics
No merged PRs in 30d

Description

### Preconditions

1. Docker 20.10.12
2. Magento Cloud Docker 1.3.2 (source code)

### Steps to reproduce

1. Start in directory with [source code of Magento Cloud Docker 1.3.2](https://github.com/magento/magento-cloud-docker/releases/tag/1.3.2).
2. `cd images/php/7.4-cli`
3. `docker build .`

### Expected result

1. The relevant step succeeds:

Step 44/48 : RUN if [ ! -z "${CRONTAB}" ]; then echo "${CRONTAB}" > /etc/cron.d/magento && touch /var/log/cron.log ; fi
---> Running in f74f6ae577c2
Removing intermediate container f74f6ae577c2
---> 7f64efe9445c

Notice the difference from current Dockerfile. Expected `RUN` instruction uses POSIX-compliant `[` instead of Bash-specific `[[`.

2. Alternatively, this instruction is deemed redundant as nobody noticed since its introduction in d78c326 (and being part of two releases).

### Actual result

1. The relevant step technically succeeds, but logically always fails no matter the actual value of `$CRONTAB`:

Step 44/48 : RUN if [[ ! -z "${CRONTAB}" ]]; then echo "${CRONTAB}" > /etc/cron.d/magento && touch /var/log/cron.log ; fi
---> Running in cc4ba5f26f15
/bin/sh: 1: [[: not found
Removing intermediate container cc4ba5f26f15
---> a329b4cfebf5

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in images/php/7.4-cli and inspect the Dockerfile instruction used during docker build. Reproduce the failure with Docker 20.10.12, then verify that the CRONTAB-related step no longer reports the shell syntax error and that the image build succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, php, shell
Domain
build-system, devops
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.