Reorder of Dockerfile for painless configuration of envvars

This commit is contained in:
Kristóf Tóth 2018-01-24 13:46:27 +01:00
parent 2b306efb04
commit 6b6f4942c0

View File

@ -35,6 +35,12 @@ RUN curl -fSL -o pyenv-installer ${PYENV_INSTALLER_URL} &&\
pyenv global ${PYTHON_VERSION} &&\
pip install tornado pyzmq transitions
USER root
WORKDIR /data/
COPY src/frontend /data/
RUN yarn install --frozen-lockfile
RUN yarn build --no-progress
ENV TFW_WEB_PORT=4242
ENV TFW_LOGIN_APP_PORT=6666
ENV TFW_PUBLIC_PORT=8888
@ -52,18 +58,12 @@ ENV TFW_SUPERVISORD_CONF="/etc/supervisor/supervisord.conf"
ENV PYTHONPATH=${TFW_LIB_DIR}
USER root
COPY src/nginx /etc/nginx
RUN chown -R ${AVATAO_USER}: /var/log/nginx /var/lib/nginx && \
# nginx runs as a regular user, and can't write to /run
sed -i 's#pid /run/nginx.pid;#pid /tmp/nginx.pid;#g' /etc/nginx/nginx.conf && \
envsubst "$(printenv | cut -d= -f1 | grep TFW_ | sed -e 's/^/$/g')" \
< /etc/nginx/sites-available/default > /etc/nginx/sites-available/default
WORKDIR /data/
COPY src/frontend /data/
RUN yarn install --frozen-lockfile
RUN yarn build --no-progress && \
< /etc/nginx/sites-available/default > /etc/nginx/sites-available/default &&\
mv /data/dist ${TFW_FRONTEND_DIR}
USER ${AVATAO_USER}