-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
93 lines (76 loc) · 1.99 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
########
# base #
########
FROM ubuntu:22.04 AS base
WORKDIR /app
ENV BASE_DIR=/app
ENV DEBIAN_FRONTEND=noninteractive
ENV IPYTHONDIR=/app/data/ipython
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED 1
ENV TZ=Europe/Prague
# install requirements and generate czech locale
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y --no-install-recommends install \
git \
libmysqlclient21 \
libpython3.10 \
locales \
mariadb-client \
nginx \
patch \
postgresql-client \
python3-pip \
sqlite3 \
supervisor \
tzdata \
&& pip3 install --no-cache-dir --upgrade pip \
&& ln -s /usr/bin/python3 /usr/local/bin/python \
&& echo cs_CZ.UTF-8 UTF-8 > /etc/locale.gen && locale-gen
ENV LC_ALL cs_CZ.UTF-8
#########
# build #
#########
FROM base AS build
RUN apt-get -y --no-install-recommends install \
build-essential \
gcc \
libicu-dev \
libmysqlclient-dev \
libssl-dev \
pkg-config \
python3-dev
RUN pip install poetry wheel
RUN virtualenv /venv
ENV VIRTUAL_ENV=/venv
COPY requirements.txt ./
RUN /venv/bin/pip install -r requirements.txt
# TODO: remove following line
RUN /venv/bin/pip install git+https://github.com/leprikon-cz/cmsplugin-filer.git@leprikon
COPY poetry.lock pyproject.toml ./
RUN poetry install --only main --no-root
COPY README.rst /app/README.rst
COPY leprikon /app/leprikon
RUN poetry install --only-root
#########
# final #
#########
FROM base AS final
LABEL name="Leprikón"
LABEL maintainer="Jakub Dorňák <[email protected]>"
COPY --from=build /venv /venv
COPY --from=build /app/leprikon /app/leprikon
ENV VIRTUAL_ENV=/venv
ENV PATH=/venv/bin:$PATH
COPY bin /app/bin
COPY conf /app/conf
COPY startup /app/startup
COPY translations /app/translations
RUN cp -a /app/translations/* /venv/lib/python3.10/site-packages/ \
&& mkdir -p data/ipython htdocs/media htdocs/static run \
&& leprikon collectstatic --no-input \
&& rm data/db.sqlite3 \
&& chown www-data:www-data data htdocs/media run
VOLUME /app/data /app/htdocs/media
CMD ["/app/bin/run-supervisord"]