-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathDockerfile
54 lines (37 loc) · 1.07 KB
/
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
54
FROM python:3.10.4 as builder
# setting the workdir
WORKDIR /usr/src/app
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# install system dependencies
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install gcc -y \
&& apt-get clean
# install dependencies
RUN pip install --upgrade pip
RUN pip install flake8
RUN flake8 --ignore=E501,F401 .
COPY ./requirements.txt .
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requirements.txt
COPY . .
FROM python:3.10.4-slim
RUN mkdir -p /home/app
# RUN addgroup app && adduser app
ENV HOME=/home/app
ENV APP_HOME=/home/app/web
RUN mkdir $APP_HOME
RUN mkdir $APP_HOME/static
RUN mkdir $APP_HOME/media
WORKDIR $APP_HOME
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install gcc -y \
&& apt-get clean
COPY --from=builder /usr/src/app/wheels /wheels
COPY --from=builder /usr/src/app/requirements.txt .
RUN pip install --no-cache /wheels/*
COPY . $APP_HOME
RUN chmod 777 $APP_HOME/entrypoint.sh
ENTRYPOINT ["/home/app/web/entrypoint.sh"]