-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
46 lines (34 loc) · 1.04 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 ubuntu:20.04 as builder
MAINTAINER grololo06 <grololo06@users.noreply.github.com>
RUN apt-get update
RUN apt-get install \
vim \
uwsgi uwsgi-plugin-python3 \
python3.8 python3.8-venv \
--no-install-recommends --yes
# Get reqs from host
COPY py/requirements.txt ./reqs.txt
# Create venv
RUN python3.8 -m venv /venv
# Install wheel & upgrade pip
RUN PATH=/venv/bin pip3 install --upgrade pip wheel
RUN PATH=/venv/bin:$PATH pip3 install -r reqs.txt
# Strip a bit...
RUN find /venv -name "*.pyc" -delete && \
rm -rf /venv/share/* && \
find /venv -name tests -type d -exec rm -rf {} + && \
find /venv/lib/python3.8/site-packages -name "*.exe" -delete
# Get source
WORKDIR /app/
COPY py ./
# Get starting script and fixed config
COPY prod_image/start.sh /app
COPY prod_image/uwsgi.ini /app
## For /app/*.log and **/__pycache__, allow non-root user to create inside dirs
## and fix startup script rights
RUN find /venv /app -type d -exec chmod a+w {} \; && \
chmod +x /app/start.sh
# uwsgi port
EXPOSE 3030
WORKDIR /app/
CMD ["./start.sh"]