mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2025-06-28 03:55:11 +00:00
Refactor project into TFW baseimage
This commit is contained in:
42
Dockerfile
42
Dockerfile
@ -34,10 +34,6 @@ RUN curl -fSL -o pyenv-installer ${PYENV_INSTALLER_URL} &&\
|
||||
pip install -r /tmp/requirements.txt
|
||||
|
||||
USER root
|
||||
COPY src/frontend /data/
|
||||
RUN cd /data && yarn install --frozen-lockfile
|
||||
RUN cd /data && yarn build --no-progress
|
||||
|
||||
ENV TFW_PUBLIC_PORT=8888 \
|
||||
TFW_WEB_PORT=4242 \
|
||||
TFW_LOGIN_APP_PORT=6666 \
|
||||
@ -70,37 +66,25 @@ RUN echo "shopt -s cmdhist\n" \
|
||||
'PROMPT_COMMAND="history -a"\n' \
|
||||
>> /home/${AVATAO_USER}/.bashrc
|
||||
|
||||
COPY supervisor/supervisord.conf ${TFW_SUPERVISORD_CONF}
|
||||
COPY nginx/nginx.conf ${TFW_NGINX_CONF}
|
||||
COPY nginx/default.conf ${TFW_NGINX_DEFAULT}
|
||||
COPY nginx/components/ ${TFW_NGINX_COMPONENTS}
|
||||
RUN chown -R ${AVATAO_USER} /var/log/nginx /var/lib/nginx &&\
|
||||
for f in "${TFW_NGINX_DEFAULT}" ${TFW_NGINX_COMPONENTS}/*.conf; do \
|
||||
envsubst "$(printenv | cut -d= -f1 | grep TFW_ | sed -e 's/^/$/g')" < $f > $f~ && mv $f~ $f ;\
|
||||
done
|
||||
|
||||
COPY supervisor/supervisord.conf ${TFW_SUPERVISORD_CONF}
|
||||
COPY supervisor/components/ ${TFW_SUPERVISORD_COMPONENTS}
|
||||
COPY lib ${TFW_LIB_DIR}
|
||||
RUN mv /data/dist ${TFW_FRONTEND_DIR} && rm -rf /data
|
||||
|
||||
### TFW internals ^ ### DEMO v ###############################################################
|
||||
ONBUILD ARG BUILD_CONTEXT="."
|
||||
ONBUILD ARG NOFRONTEND=""
|
||||
|
||||
ENV TFW_APP_DIR="/srv/app" \
|
||||
TFW_LOGIN_APP_DIR="/tmp/source_code_server" \
|
||||
TFW_WEBIDE_WD="/home/${AVATAO_USER}/workdir" \
|
||||
TFW_TERMINADO_WD="/home/${AVATAO_USER}/workdir"
|
||||
ONBUILD COPY ${BUILD_CONTEXT}/nginx/components/ ${TFW_NGINX_COMPONENTS}
|
||||
ONBUILD COPY ${BUILD_CONTEXT}/supervisor/components/ ${TFW_SUPERVISORD_COMPONENTS}
|
||||
|
||||
COPY src/demo ${TFW_APP_DIR}/
|
||||
ONBUILD RUN chown -R ${AVATAO_USER} /var/log/nginx /var/lib/nginx &&\
|
||||
for f in "${TFW_NGINX_DEFAULT}" ${TFW_NGINX_COMPONENTS}/*.conf; do \
|
||||
envsubst "$(printenv | cut -d= -f1 | grep TFW_ | sed -e 's/^/$/g')" < $f > $f~ && mv $f~ $f ;\
|
||||
done
|
||||
|
||||
COPY src/demo/source_code_server/server.py ${TFW_LOGIN_APP_DIR}/
|
||||
COPY src/demo/source_code_server/users.db ${TFW_LOGIN_APP_DIR}/
|
||||
COPY src/demo/source_code_server/login_component.py ${TFW_WEBIDE_WD}/
|
||||
|
||||
RUN chown -R ${AVATAO_USER} ${TFW_WEBIDE_WD} &&\
|
||||
chmod -R 755 ${TFW_WEBIDE_WD}
|
||||
|
||||
USER ${AVATAO_USER}
|
||||
VOLUME ["/etc/nginx", "/home/${AVATAO_USER}", "/var/lib/nginx", "/var/log/nginx"]
|
||||
WORKDIR /home/${AVATAO_USER}
|
||||
ONBUILD COPY ${BUILD_CONTEXT}/frontend /data/
|
||||
ONBUILD RUN if [ -z "${NOFRONTEND}" ]; then cd /data && yarn install --frozen-lockfile; fi
|
||||
ONBUILD RUN if [ -z "${NOFRONTEND}" ]; then cd /data && yarn build --no-progress; fi
|
||||
ONBUILD RUN if [ -z "${NOFRONTEND}" ]; then mv /data/dist ${TFW_FRONTEND_DIR} && rm -rf /data; fi
|
||||
|
||||
CMD . "$HOME/.pyenvrc" && exec supervisord --nodaemon
|
||||
|
Reference in New Issue
Block a user