-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
35 lines (25 loc) · 907 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
FROM python:3.11.5-slim as build
ENV PIP_DEFAULT_TIMEOUT=100 \
PYTHONUNBUFFERED=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1
RUN mkdir -p /keyword
COPY . /keyword
WORKDIR /keyword
RUN set -ex \
&& addgroup --system --gid 1001 appgroup \
&& adduser --system --uid 1001 --gid 1001 --no-create-home appuser \
&& apt-get update \
&& apt-get install -y --no-install-recommends git \
&& pip install --no-cache-dir -r requirements.txt \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /root/.cache/pip/*
FROM gcr.io/distroless/python3
COPY --from=build /usr/local/bin/python3.11 /usr/local/bin/python3.11
COPY --from=build /usr/local/lib/python3.11 /usr/local/lib/python3.11
COPY --from=build /keyword /keyword
WORKDIR /keyword
ENV PYTHONPATH=/usr/local/lib/python3.11/site-packages
CMD [ "main.py" ]