-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
41 lines (30 loc) · 964 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
FROM python:3.9 AS builder
RUN apt-get update && \
apt-get install -y --no-install-recommends \
gcc \
python3-dev \
libpq-dev
COPY requirements.txt /tmp/pip-tmp/
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN python -m pip install --no-cache-dir --upgrade pip && \
python -m pip install --no-cache-dir -r /tmp/pip-tmp/requirements.txt
FROM python:3.9-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libpq-dev && \
apt-get clean && \
rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*
RUN addgroup --gid 1001 --system crypto && \
adduser --shell /bin/false --disabled-password --uid 1001 --system --group crypto
RUN mkdir -p /app
RUN chown crypto:crypto /app
USER crypto
WORKDIR /app
ENV PATH="/opt/venv/bin:$PATH"
COPY --from=builder /opt/venv /opt/venv
COPY --chown=crypto:crypto ./src .
CMD [ "python", "-u", "runner.py" ]