-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (23 loc) · 825 Bytes
/
Copy pathDockerfile
File metadata and controls
31 lines (23 loc) · 825 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
FROM python:3.10-slim
RUN adduser --disabled-password --gecos '' python;\
mkdir /opt/python;\
chown python:python /opt/python
RUN apt-get update && apt-get -y --no-install-recommends install\
git \
&& python3 -m pip install --upgrade pip \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*
# rm -rf /var/lib/apt/lists/* command cleans up apt cache
# switch from root user to python
USER python
WORKDIR /opt/python
# prevent from writing pycfiles
ENV PYTHONDONTWRITEBYTECODE=1
# Show messages on the console
ENV PYTHONUNBUFFERED=1
COPY --chown=python:python requirements.txt ./
ENV PATH="/home/python/.local/bin:$PATH"
RUN pip3 install -r requirements.txt
COPY --chown=python:python . .
RUN chmod +x start.sh
CMD ./start.sh