-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Dockerfile.nightly
85 lines (68 loc) · 2.61 KB
/
Dockerfile.nightly
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
# syntax=docker/dockerfile:1
ARG PYTHON_VERSION=3.11
FROM python:${PYTHON_VERSION}-slim-bullseye as base
FROM base as builder
ENV PIP_PARAMS=""
ENV PIP_VERSION=22.3.1
ENV EXTRA_PACKAGES="relstorage==3.5.0 psycopg2==2.9.5 python-ldap==3.4.3"
RUN mkdir /wheelhouse
RUN <<EOT
set -e
apt-get update
buildDeps="build-essential curl libbz2-dev libffi-dev libjpeg62-turbo-dev libldap2-dev libopenjp2-7-dev libpcre3-dev libpq-dev libsasl2-dev libssl-dev libtiff5-dev libxml2-dev libxslt1-dev wget unzip zlib1g-dev"
apt-get install -y --no-install-recommends $buildDeps
pip install -U "pip==${PIP_VERSION}"
pip install -U "zc.buildout>=3.0.0rc1" "wheel"
rm -rf /var/lib/apt/lists/* /usr/share/doc
curl -L -o workspace.zip https://github.com/plone/buildout.coredev/archive/refs/heads/6.0.zip
unzip workspace.zip
mv buildout.coredev-6.0 /workspace
EOT
WORKDIR /workspace
COPY --chown=500:500 /helpers/pip-from-buildout-coredev.py ./
# Generate pip-requirements.txt
RUN <<EOT
set -e
python pip-from-buildout-coredev.py
pip wheel -r pip-requirements.txt -c pip-constraints.txt --wheel-dir=/wheelhouse
pip wheel $EXTRA_PACKAGES -c pip-constraints.txt --wheel-dir=/wheelhouse
EOT
FROM base
ENV PIP_PARAMS=""
ENV PIP_VERSION=22.0.4
LABEL maintainer="Plone Community <[email protected]>" \
org.label-schema.name="plone-backend" \
org.label-schema.description="Plone backend image using Python 3.10" \
org.label-schema.vendor="Plone Foundation"
COPY --from=builder /wheelhouse /wheelhouse
RUN <<EOT
set -e
useradd --system -m -d /app -U -u 500 plone
runDeps="git libjpeg62 libopenjp2-7 libpq5 libtiff5 libxml2 libxslt1.1 lynx netcat poppler-utils rsync wv busybox libmagic1 gosu make"
apt-get update
apt-get install -y --no-install-recommends $runDeps
busybox --install -s
rm -rf /var/lib/apt/lists/* /usr/share/doc
mkdir -p /data/filestorage /data/blobstorage /data/log /data/cache
EOT
WORKDIR /app
RUN <<EOT
set -e
python -m venv .
./bin/pip install -U "pip==${PIP_VERSION}"
./bin/pip install --force-reinstall --no-index --no-deps ${PIP_PARAMS} /wheelhouse/*
find . \( -type f -a -name '*.pyc' -o -name '*.pyo' \) -exec rm -rf '{}' +
rm -rf .cache
EOT
COPY skeleton/ /app
RUN <<EOT
set -e
ln -s /data var
find /data -not -user plone -exec chown plone:plone {} \+
find /app -not -user plone -exec chown plone:plone {} \+
EOT
EXPOSE 8080
VOLUME /data
HEALTHCHECK --interval=10s --timeout=5s --start-period=30s CMD wget -q http://127.0.0.1:8080/ok -O - | grep OK || exit 1
ENTRYPOINT [ "/app/docker-entrypoint.sh" ]
CMD ["start"]