0

Example found on GitHub:

FROM "xxx"/nginx-php-fpm:php73

MAINTAINER "xxx"

# Remove existing webroot, configure PHP session handler for Redis, install postgresql-client (pg_dump)
RUN rm -rf /usr/share/nginx/* && \
sed -i -e "s/memory_limit\s*=\s*.*/memory_limit = 256M/g" ${php_conf} && \
...

As I have understood the meaning of OPTIONS:
-i: "where to edit" and
-e: "script to be executed"

My question is: What does this line do?
sed -i -e "s/memory_limit\s*=\s*.*/memory_limit = 256M/g" ${php_conf}

When I try to run the line the response is: sed: no input files
How does it understand the ${php_conf}?

Arya N
  • 95
  • 1
  • 1
  • 6
  • Clearly it doesn't, probably because you have not defined this variable. – tripleee Feb 06 '19 at 13:12
  • https://github.com/wyveo/craftcms-docker/blob/craft3/Dockerfile is rather inefficient; somebody should tell the maintainer [how to combine multiple `sed` commands in one script.](/questions/7657647/combining-two-sed-commands) – tripleee Feb 06 '19 at 13:15
  • https://gitlab.com/wyveo/nginx-php-fpm/blob/master/Dockerfile#L8 seems to be where the variable gets defined. This too has the same antipattern. – tripleee Feb 06 '19 at 13:16

1 Answers1

0

That line is replacing all the matches memory_limit = ... to memory_limit = 256M in the php_conf file.
The problem in that Dockerfile is that you have not defined the environment variable php_conf and therefore there's no input file.

You could easily fix that by adding the env variable before your RUN command:

ENV php_conf /path/to/your/php_config
GileBrt
  • 1,830
  • 3
  • 20
  • 28