Newer
Older
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
FROM python:3.7-slim AS compile-image
ARG DEBIAN_FRONTEND=noninteractive
RUN { \
echo krb5-config krb5-config/default_realm string 'LOCAL.ISIMA.FR'; \
echo tzdata tzdata/Areas string 'Etc'; \
echo tzdata tzdata/Zones/Etc string 'UTC'; \
} | debconf-set-selections \
&& \
apt-get update && apt-get install -y --no-install-recommends \
build-essential \
gcc \
apt-utils \
krb5-user \
locales \
rsync \
&& \
locale-gen fr_FR \
locale-gen fr_FR.UTF-8 \
update-locale LANG=fr_FR.UTF-8 \
. /etc/default/locale
COPY requirements.txt .
RUN pip install --user -r requirements.txt
FROM python:3.7-slim AS build-image
COPY --from=compile-image /root/.local /root/.local
COPY --from=compile-image /usr/bin /usr/bin
COPY --from=compile-image /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu
LABEL stage=builder
ENV SRV_DIR=//srv
ENV WORKING_DIR=//srv/pelican
ENV PORT=8000
ENV PATH=/root/.local/bin:$PATH
ADD . $SRV_DIR
WORKDIR $WORKING_DIR
RUN mkdir output content cache
VOLUME ["$WORKING_DIR/"]
# make python server in foreground
RUN sed -i 's/\$port &/\$port/g' $SRV_DIR/develop_server.sh
RUN chmod +x $SRV_DIR/develop_server.sh
EXPOSE $PORT
ENTRYPOINT $SRV_DIR/develop_server.sh start $PORT