Skip to content

Commit

Permalink
Merge pull request docker-library#282 from infosiftr/override-envvars
Browse files Browse the repository at this point in the history
Convert explicit "export A=B" lines of Apache's envvars file into "${A:=B}" such that we can override them at runtime easily
  • Loading branch information
yosifkit authored Aug 8, 2016
2 parents 2cc40ce + aea63e3 commit 893b4f7
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
11 changes: 10 additions & 1 deletion 5.5/apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,17 @@ RUN apt-get update && apt-get install -y apache2-bin apache2.2-common --no-insta
ENV APACHE_CONFDIR /etc/apache2
ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars

# setup directories and permissions
RUN set -ex \
\
# generically convert lines like
# export APACHE_RUN_USER=www-data
# into
# : ${APACHE_RUN_USER:=www-data}
# export APACHE_RUN_USER
# so that they can be overridden at runtime ("-e APACHE_RUN_USER=...")
&& sed -r 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS" \
\
# setup directories and permissions
&& . "$APACHE_ENVVARS" \
&& for dir in \
"$APACHE_LOCK_DIR" \
Expand Down
11 changes: 10 additions & 1 deletion 5.6/apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,17 @@ RUN apt-get update && apt-get install -y apache2-bin apache2.2-common --no-insta
ENV APACHE_CONFDIR /etc/apache2
ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars

# setup directories and permissions
RUN set -ex \
\
# generically convert lines like
# export APACHE_RUN_USER=www-data
# into
# : ${APACHE_RUN_USER:=www-data}
# export APACHE_RUN_USER
# so that they can be overridden at runtime ("-e APACHE_RUN_USER=...")
&& sed -r 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS" \
\
# setup directories and permissions
&& . "$APACHE_ENVVARS" \
&& for dir in \
"$APACHE_LOCK_DIR" \
Expand Down
11 changes: 10 additions & 1 deletion 7.0/apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,17 @@ RUN apt-get update && apt-get install -y apache2-bin apache2.2-common --no-insta
ENV APACHE_CONFDIR /etc/apache2
ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars

# setup directories and permissions
RUN set -ex \
\
# generically convert lines like
# export APACHE_RUN_USER=www-data
# into
# : ${APACHE_RUN_USER:=www-data}
# export APACHE_RUN_USER
# so that they can be overridden at runtime ("-e APACHE_RUN_USER=...")
&& sed -r 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS" \
\
# setup directories and permissions
&& . "$APACHE_ENVVARS" \
&& for dir in \
"$APACHE_LOCK_DIR" \
Expand Down
11 changes: 10 additions & 1 deletion apache-Dockerfile-block-1
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@ RUN apt-get update && apt-get install -y apache2-bin apache2.2-common --no-insta
ENV APACHE_CONFDIR /etc/apache2
ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars

# setup directories and permissions
RUN set -ex \
\
# generically convert lines like
# export APACHE_RUN_USER=www-data
# into
# : ${APACHE_RUN_USER:=www-data}
# export APACHE_RUN_USER
# so that they can be overridden at runtime ("-e APACHE_RUN_USER=...")
&& sed -r 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS" \
\
# setup directories and permissions
&& . "$APACHE_ENVVARS" \
&& for dir in \
"$APACHE_LOCK_DIR" \
Expand Down

0 comments on commit 893b4f7

Please sign in to comment.