-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
67 lines (47 loc) · 1.31 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
64
65
66
67
FROM python:3-alpine
# Dockerfile arguments
ARG APP_DIR=/app
ARG USER=filmography
ARG PORT=8080
# Define base configuration
ENV PYTHONPATH=$APP_DIR
ENV GUNICORN=/usr/local/bin/gunicorn
ENV FLASK=/usr/local/bin/flask
ENV SERVER=0.0.0.0
ENV PORT=$PORT
# Change base directory
WORKDIR $APP_DIR
# Create application user & work directory
RUN adduser \
-u 1000 \
-D -H \
-h $APP_DIR \
$USER
# Upgrade base image
RUN apk upgrade \
--update --no-cache \
&& apk add \
--update --no-cache \
make ca-certificates
# Install required libraries/packages
COPY Makefile ./
RUN --mount=type=bind,source=requirements.txt,target=requirements.txt \
apk add --update --no-cache --virtual .build build-base \
libxml2-dev libxslt-dev \
&& make install-docker \
&& apk del .build
RUN --mount=type=bind,source=patches,target=patches \
apk add --update --no-cache --virtual .build patch \
&& patch -u /usr/local/lib/python3.11/site-packages/tmdbsimple/tv.py patches/tv_watch_providers.patch \
&& apk del .build
# Copy application sources
COPY filmography filmography
COPY main.py .flaskenv ./
# Compile app Python files
RUN python -m compileall filmography main.py
# Change user for runtime
USER $USER
# Declare application listen port
EXPOSE $PORT
# Declare application command start
CMD ["make", "run"]