more Dockerfile tweaking

This commit is contained in:
Marvin Steadfast 2019-04-16 21:23:01 +02:00
parent 368e3d4a85
commit 40adac68a1

View File

@ -4,21 +4,12 @@ ENV SSL_CERT_FILE /etc/ssl/certs/ca-certificates.crt
ENV BLOG_UID 1000
ENV BLOG_GID 1000
RUN set -ex \
&& echo "http://nl.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
&& apk upgrade -a --no-cache \
&& apk add --no-cache \
lftp \
make \
tzdata \
&& cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime \
&& echo "Europe/Berlin" > /etc/timezone \
&& apk del tzdata \
&& addgroup -g $BLOG_GID blog \
&& adduser -h /home/blog -D -s /bin/sh -G blog blog \
&& chown -R $BLOG_UID:$BLOG_GID /home/blog
COPY requirements.txt .
&& pip install -U pip \
&& mkdir /wheels
COPY requirements.txt /wheels/requirements.txt
FROM base as builder
FROM base as wheel_builder
RUN set -ex \
&& apk add --no-cache\
ca-certificates \
@ -31,14 +22,24 @@ RUN set -ex \
linux-headers \
make \
musl-dev \
&& pip install -r requirements.txt
&& pip wheel -w /wheels -r /wheels/requirements.txt
FROM base
COPY --from=builder /root/.cache /root/.cache
COPY --from=wheel_builder /wheels /wheels
RUN set -ex \
&& pip install -r requirements.txt \
&& pip install -r /wheels/requirements.txt -f /wheels \
&& rm -rf /root/.cache \
&& rm requirements.txt
&& rm -rf /wheels \
&& apk add --no-cache \
lftp \
make \
tzdata \
&& cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime \
&& echo "Europe/Berlin" > /etc/timezone \
&& apk del tzdata \
&& addgroup -g $BLOG_GID blog \
&& adduser -h /home/blog -D -s /bin/sh -G blog blog \
&& chown -R $BLOG_UID:$BLOG_GID /home/blog
USER blog
WORKDIR /blog
EXPOSE 8000