cours-snt/test-python-ssh/Dockerfile

32 lines
937 B
Docker
Raw Normal View History

2021-02-15 09:37:35 +00:00
FROM python:3
#TODO as an educational env, we sould use debian or centos. more like debian? A dockerfile each?
2021-02-05 16:11:47 +00:00
2021-02-15 09:37:35 +00:00
RUN apt update && apt install -y gcc nginx openssh-server
RUN pip3 install uwsgi
2021-02-05 16:11:47 +00:00
2021-02-15 12:51:48 +00:00
WORKDIR /app
2021-02-05 16:11:47 +00:00
2021-02-15 09:37:35 +00:00
RUN addgroup eleve
2021-02-05 16:11:47 +00:00
# Python app
2021-02-15 09:37:35 +00:00
COPY python_app/ ./python_app
2021-02-05 16:11:47 +00:00
ENV UID=33
ENV MOUNT=/
2021-02-15 09:37:35 +00:00
ENV TZ=Europe/Paris
2021-02-05 16:11:47 +00:00
2021-02-15 09:37:35 +00:00
RUN mkdir /tmp/uwsgi
CMD ["uwsgi", "-s", "/tmp/uwsgi/uwsgi.sock", "--chown-socket", "${UID}", "--manage-script-name", "--mount", "${MOUNT}=python_app.main:application", "--http-timeout", "10", "--master", "--hook-master-start", "'unix_signal:15 gracefully_kill_them_all'", "--need-app", "--die-on-term", "--show-config", "--log-master", "--strict", "--vacuum", "--single-interpreter"]
#CMD ["sh", "-c", "echo lol"]
2021-02-05 16:11:47 +00:00
# SSH server
2021-02-15 09:37:35 +00:00
RUN mkdir /run/sshd
2021-02-05 16:11:47 +00:00
# Nginx server
2021-02-15 09:37:35 +00:00
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
COPY ./nginx/favicon.ico ./
2021-02-05 16:11:47 +00:00
# Entrypoint
COPY ./entrypoint.sh ./entrypoint.sh
2021-02-04 18:11:00 +00:00
ENTRYPOINT ["./entrypoint.sh"]