1
0
mirror of https://github.com/avatao-content/test-tutorial-framework synced 2025-06-28 18:55:13 +00:00

Strip old sqli example app and replace it with a simple login service

This commit is contained in:
Kristóf Tóth
2018-04-25 11:52:42 +02:00
parent 54b299e7ef
commit 1a295d5fd6
15 changed files with 250 additions and 70 deletions

View File

@ -1,19 +1,26 @@
FROM eu.gcr.io/avatao-challengestore/tutorial-framework
# Define variables to use later
ENV TFW_SERVER_DIR="/srv/.tfw" \
TFW_LOGIN_APP_DIR="/tmp/source_code_server" \
TFW_IDE_WD="/home/${AVATAO_USER}/workdir" \
TFW_LOGIN_SERVICE_DIR="/srv/login_service" \
TFW_IDE_WD="/home/${AVATAO_USER}/workdir" \
TFW_TERMINADO_WD="/home/${AVATAO_USER}/workdir"
# Copy TFW related stuff to a dedicated directory
COPY solvable/src ${TFW_SERVER_DIR}/
COPY solvable/src/source_code_server/server.py ${TFW_LOGIN_APP_DIR}/
COPY solvable/src/source_code_server/users.db ${TFW_LOGIN_APP_DIR}/
COPY solvable/src/source_code_server/login_component.py ${TFW_IDE_WD}/
RUN chown -R ${AVATAO_USER} ${TFW_IDE_WD} &&\
chmod -R 755 ${TFW_IDE_WD} &&\
chown -R root ${TFW_SERVER_DIR} &&\
chmod -R 700 ${TFW_SERVER_DIR}
# Copy webservice to a dedicated directory
COPY solvable/src/webservice/ ${TFW_LOGIN_SERVICE_DIR}/
ADD solvable/src/webservice/frontend-deps.tar ${TFW_LOGIN_SERVICE_DIR}/static
# Create IDE directory, add a file to it and give proper permissions to AVATAO_USER
RUN mkdir -p ${TFW_IDE_WD} &&\
echo "This is a file in ${TFW_IDE_WD}" > ${TFW_IDE_WD}/text.txt &&\
chown -R ${AVATAO_USER}: ${TFW_IDE_WD} && chmod -R 755 ${TFW_IDE_WD}
# Hide TFW related code from user
RUN chown -R root:root ${TFW_SERVER_DIR} && chmod -R 700 ${TFW_SERVER_DIR}
# Make AVATAO_USER's home writeable and set it as WORKDIR
VOLUME ["/home/${AVATAO_USER}"]
WORKDIR /home/${AVATAO_USER}