-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
46 lines (37 loc) · 1.08 KB
/
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
42
43
44
45
46
FROM python:3.9-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\
binutils \
build-essential \
curl \
fiona \
gdal-bin \
git \
libgdal-dev \
libpq-dev \
libproj-dev \
# for django DB graph
python3-pygraphviz \
wget \
zlib1g-dev \
&& 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
# create staticfiles directory
RUN mkdir -p staticfiles
# 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