-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
63 lines (47 loc) · 1.98 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
FROM --platform=linux/arm64 python:3.9
#nginx/unit:1.23.0-python3.9
# Our Debian with Python and Nginx for python apps.
# See https://hub.docker.com/r/nginx/unit/
ENV PYTHONUNBUFFERED 1
COPY ./app/initial.sh /docker-entrypoint.d/initial.sh
COPY ./config/config.json /docker-entrypoint.d/config.json
# Ok, this is something we get thanks to the Nginx Unit Image.
# We don't need to call stuff like
# curl -X PUT --data-binary @config.json --unix-socket \
# /path/to/control.unit.sock http://localhost/config/
# to set our configuration
# Becouse as stated in docs https://unit.nginx.org/installation/#docker-images,
# configuration snippets are
# uploaded as to the config section of Unit’s configuration
# That means we only have to copy our config.json file to the folder
# /docker-entrypoint.d/
RUN mkdir build
# We create folder named build for our app.
WORKDIR /build
COPY ./app ./app
COPY ./pytest.ini .
COPY ./aerich.ini .
COPY ./requirements.txt .
COPY ./.env .
# We copy our app folder to the /build
RUN pip install -U pip
# RUN \
# # apt update \
# # && apt install -y python3-pip \
# /usr/local/bin/python3 -m pip install --upgrade pip
# RUN python3 -m pip install -r requirements.txt --default-timeout=100
#--upgrade --default-timeout=100
#--use-deprecated=legacy-resolver
#--no-cache-dir
RUN pip install -r requirements.txt --default-timeout=100 --no-cache-dir
# --use-deprecated=legacy-resolver
# RUN apt remove -y python3-pip \
# && apt autoremove --purge -y \
# && rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/*.list
# OK, that looks strange but here's a explanation from Nginx docs
# https://unit.nginx.org/howto/docker/:
# """ PIP isn't installed by default, so we install it first.
# Next, we install the requirements, remove PIP, and perform image cleanup. """
# Note we use /build/requirements.txt since this is our file
# RUN ["chmod", "+x", "./app/initial.sh"]
ENTRYPOINT ["sh", "/docker-entrypoint.d/initial.sh"]