-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
46 lines (35 loc) · 1.15 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
FROM python:3.9.10-slim-buster as compile-image
LABEL Joseph Ziegler "[email protected]"
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential python3-dev supervisor apt-utils && \
rm -rf /var/lib/apt/lists/*
WORKDIR /opt/venv
# Create virtual environment
RUN python3 -m venv .
# Make sure virtualenv is used
ENV PATH="/opt/venv/bin:$PATH"
COPY ./requirements.txt ./
RUN pip install --upgrade pip && \
pip install --upgrade markupsafe && \
pip3 install -r requirements.txt
# ---------------------------------------
FROM python:3.9.10-slim-buster as running-image
RUN apt-get update && \
apt-get install -y --no-install-recommends \
supervisor && \
rm -rf /var/lib/apt/lists/*
WORKDIR /opt/app
COPY . .
COPY --from=compile-image /opt/venv ./venv
RUN useradd appuser
RUN chown -R appuser /opt/app
COPY supervisord.conf /etc/
RUN chmod 0644 /etc/supervisord.conf
COPY celery.conf /opt/app/venv/bin/celery
RUN chmod +x /opt/app/venv/bin/celery && \
chown appuser /opt/app/venv/bin/celery && \
chmod 744 /opt/app/*.py
USER appuser
ENV PATH="/opt/app/venv/bin:$PATH"
CMD ["/usr/bin/supervisord"]