-
Notifications
You must be signed in to change notification settings - Fork 17
/
Dockerfile
39 lines (29 loc) · 916 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
FROM python:3.9.10-slim-buster as compile-image
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential python3-dev 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 && \
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
USER appuser
ENV PATH="/opt/app/venv/bin:$PATH"
CMD ["/usr/bin/supervisord"]