-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
105 lines (71 loc) · 2.36 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
FROM node:alpine as builder-node
# set work directory
WORKDIR /usr/src/app
# copy requirements.txt only (better for caching)
COPY package.json ./
# run yarn install
RUN yarn install
# copy js/css source
COPY static ./static
# copy webpack conf
COPY webpack.config.js ./
# run webpack
RUN npx webpack --config webpack.config.js --mode=production
FROM python:3-alpine
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# set work directory
WORKDIR /usr/src/app
# update package lists
RUN apk update
# configure timezone
RUN apk add --no-cache tzdata
ENV TZ Europe/Berlin
# requirements for pyscop2
RUN apk add postgresql-dev gcc python3-dev musl-dev
# postgres client (required for postgres availability detection)
RUN apk add postgresql-client
# required for compiling translation files
RUN apk add gettext-dev
# requirements for python pillow
RUN apk add freetype-dev fribidi-dev harfbuzz-dev jpeg-dev lcms2-dev openjpeg-dev tcl-dev tiff-dev tk-dev zlib-dev
# requirements for pyheif
RUN apk add libffi libffi-dev libheif libheif-dev libde265-dev
# requirements for pyzbar
RUN apk add zbar zbar-dev
# requirements for pdf2image
RUN apk add poppler-utils
# wsgi server for production deployment
RUN pip install gunicorn
# copy requirements.txt only (better for caching)
COPY requirements.txt /usr/src/app
# install pip packages
RUN pip install -r requirements.txt
# copy yarn dependencies
# COPY --from=builder-node /usr/src/app/node_modules ./node_modules
# copy project dir
COPY . /usr/src/app
# copy webpack output
COPY --from=builder-node /usr/src/app/webpack-stats.json ./
COPY --from=builder-node /usr/src/app/static/webpack_bundles ./static/webpack_bundles
# copy entrypoint
ADD .deployment/docker-entrypoint.sh /
# create package dir
RUN mkdir -p data/packages
# chmod entrypoint
RUN chmod a+x /docker-entrypoint.sh
# set port
EXPOSE 80
# set user
#USER nobody
# set entrypoint
ENTRYPOINT ["/docker-entrypoint.sh"]
# set cmd -> for webserver
#CMD ["python", "manage.py", "runserver", "[::]:80"]
CMD ["gunicorn", "cwa_venue_notifier.wsgi:application", "--bind", "[::]:80"]
# set cmd -> for celery worker ("-B" enables beat)
ENV C_FORCE_ROOT=1
#CMD ["celery", "-A", "cwa_venue_notifier", "worker", "-B", "-E", "-Q", "celery", "-l", "INFO", "-s", "/tmp/celerybeat-schedule"]
# set cmd -> for telegram bot
#CMD ["python", "manage.py", "start_polling"]