-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
53 lines (36 loc) · 1008 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
FROM python:3.10-slim AS development
RUN mkdir /cadet
RUN mkdir /db
WORKDIR /cadet
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY app app
COPY migrations migrations
COPY cadet.py config.py .flaskenv .
RUN flask db upgrade
RUN flask add-user --admin --instructor [email protected] Yo Teacher
VOLUME /cadet
EXPOSE 5000
CMD ["flask", "run"]
FROM python:3.9-slim-buster
RUN apt-get update
RUN adduser --system --group --uid 2000 cadet
RUN mkdir /cadet
RUN mkdir /cadet/instance
WORKDIR /cadet
COPY requirements.txt requirements.txt
RUN python -m venv venv
RUN venv/bin/pip install -r requirements.txt
RUN venv/bin/pip install gunicorn
COPY app app
COPY migrations migrations
COPY cadet.py config.py boot-webapp.sh ./
COPY instance_config.py instance/config.py
RUN chmod +x boot-webapp.sh
ENV FLASK_APP cadet.py
ENV SCRIPT_NAME /cadet
ENV APP_CONFIG_CLASS config.ProductionConfig
RUN chown -R cadet:cadet ./
USER cadet
EXPOSE 5500
ENTRYPOINT ["./boot-webapp.sh"]