From d078590e6a49394e5cb5fd1fe2c93cf1b38e46f2 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Fri, 19 Mar 2021 10:10:54 -0400 Subject: [PATCH] Fix building docker images (#335) Switch Docker images from Alpine -> Debian. --- Dockerfile | 30 ++++++++++++------------------ changelog.d/335.docker | 1 + pyproject.toml | 5 +++++ 3 files changed, 18 insertions(+), 18 deletions(-) create mode 100644 changelog.d/335.docker diff --git a/Dockerfile b/Dockerfile index 9abac691..778921ef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,15 @@ # # Step 1: Build sydent and install dependencies # -FROM docker.io/python:3.8-alpine as builder +FROM docker.io/python:3.8-slim as builder # Install dev packages -RUN apk add --no-cache \ - build-base \ - libressl-dev \ - libffi-dev +RUN apt-get update && apt-get install -y \ + build-essential # Add user sydent -RUN addgroup -S -g 993 sydent \ - && adduser -D --home /sydent -S -u 993 -G sydent -s /bin/ash sydent \ +RUN addgroup --system --gid 993 sydent \ + && adduser --disabled-password --home /sydent --system --uid 993 --gecos sydent sydent \ && echo "sydent:$(dd if=/dev/random bs=32 count=1 | base64)" | chpasswd # Copy resources @@ -21,9 +19,10 @@ COPY --chown=sydent:sydent ["sydent", "/sydent/sydent"] COPY --chown=sydent:sydent ["README.rst", "setup.cfg", "setup.py", "/sydent/"] # Install dependencies -RUN cd /sydent \ - && su sydent -c 'pip install --user --upgrade pip setuptools sentry-sdk prometheus_client' \ - && su sydent -c 'pip install --user -e .' \ +USER sydent +WORKDIR /sydent +RUN pip install --user --upgrade pip setuptools sentry-sdk prometheus_client \ + && pip install --user . \ && rm -rf /sydent/.cache \ && find /sydent -name '*.pyc' -delete @@ -31,16 +30,11 @@ RUN cd /sydent \ # Step 2: Reduce image size and layers # -FROM docker.io/python:3.8-alpine - -# Install packages -RUN apk add --no-cache \ - libressl \ - libffi +FROM docker.io/python:3.8-slim # Add user sydent and create /data directory -RUN addgroup -S -g 993 sydent \ - && adduser -D --home /sydent -S -u 993 -G sydent -s /bin/ash sydent \ +RUN addgroup --system --gid 993 sydent \ + && adduser --disabled-password --home /sydent --system --uid 993 --gecos sydent sydent \ && echo "sydent:$(dd if=/dev/random bs=32 count=1 | base64)" | chpasswd \ && mkdir /data \ && chown sydent:sydent /data diff --git a/changelog.d/335.docker b/changelog.d/335.docker new file mode 100644 index 00000000..93c60a5b --- /dev/null +++ b/changelog.d/335.docker @@ -0,0 +1 @@ +Base docker image on Debian rather than Alpine Linux. diff --git a/pyproject.toml b/pyproject.toml index 331ca14f..078924ee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,11 @@ name = "Bugfixes" showcontent = true + [[tool.towncrier.type]] + directory = "docker" + name = "Updates to the Docker image" + showcontent = true + [[tool.towncrier.type]] directory = "doc" name = "Improved Documentation"