-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (31 loc) · 967 Bytes
/
Dockerfile
File metadata and controls
37 lines (31 loc) · 967 Bytes
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
FROM python:__PYTHON_VERSION__-slim as builder
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
RUN apt-get update && \
apt-get install -y --no-install-recommends gcc
WORKDIR /app
COPY . .
RUN pip install --no-cache-dir setuptools wheel && \
pip wheel --no-cache-dir \
--no-deps \
--wheel-dir /app/.wheels \
--requirement requirements.txt && \
python setup.py bdist_wheel && \
cp dist/*.whl /app/.wheels
# --[[ NEXT STAGE
FROM python:__PYTHON_VERSION__-slim
WORKDIR /app
COPY --from=builder /app/.wheels /app/.wheels
RUN pip install --no-cache /app/.wheels/* && \
rm -rf /app/.wheels && \
addgroup --gid 1001 --system app && \
adduser --no-create-home \
--shell /bin/false \
--disabled-password \
--uid 1001 \
--system \
--group \
app
USER app
ENTRYPOINT ["python", "-OO", "-m", "__PACKAGE_LOWER__"]
CMD ["server"]