Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker: switch back to debian base image #426

Merged
merged 1 commit into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ jobs:
echo ::set-output name=version::snapshot
fi
echo ::set-output name=build_date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
# Work around an armv7 -> qemu bug caused during rust compilation. Yeah.. See repo.
- name: Run Docker on tmpfs
uses: JonasAlfredsson/docker-on-tmpfs@v1
with:
tmpfs_size: 5
swap_size: 4
swap_location: '/mnt/swapfile'

-
name: Set up Docker Buildx
id: buildx
Expand Down
59 changes: 32 additions & 27 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3-alpine
FROM python:3.10.5-bullseye

RUN mkdir /app
WORKDIR /app
Expand All @@ -9,44 +9,49 @@ ENV SHELL=/bin/sh \
KEGBOT_IN_DOCKER=True \
KEGBOT_ENV=debug

RUN apk update && \
apk add --no-cache \
bash \
# Install toolchains. Mostly, image libraries that Python PIL/Pillow will require.
RUN apt-get -qq update \
&& DEBIAN_FRONTEND=noninteractive apt-get -y install \
curl \
libjpeg \
libjpeg-turbo \
openjpeg \
mariadb-connector-c-dev \
libpq && \
apk add --no-cache --virtual _build-deps \
build-base \
mariadb-dev \
postgresql-dev \
libjpeg-turbo-dev \
zlib-dev \
py-gevent \
libffi-dev \
musl-dev \
python3-dev \
openssl-dev \
cargo

RUN pip install poetry

libffi-dev \
libfreetype6-dev \
libfribidi-dev \
libharfbuzz-dev \
libjpeg-turbo-progs \
libjpeg62-turbo-dev \
liblcms2-dev \
libopenjp2-7-dev \
libtiff5-dev \
libwebp-dev \
libssl-dev \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/* \
&& python -m pip install -U pip \
# The cryptography build requires rust, which adds >1GB to the image. \
# Install it only to install cryptography, then remove it. \
&& curl https://sh.rustup.rs -sSf | sh -s -- -y \
&& PATH=/root/.cargo/bin:$PATH pip install cryptography \
&& rm -rf /root/.rustup /root/.cargo \
&& pip install poetry \
&& rm -rf /root/.cache

# Install python dependencies.
COPY pyproject.toml poetry.lock ./
ADD pykeg/__init__.py ./pykeg/
RUN poetry config virtualenvs.create false && poetry install -n

# Install the app itself.
ADD bin ./bin
ADD pykeg ./pykeg
RUN poetry run python bin/kegbot collectstatic --noinput -v 0

# Tag the build with build information.
ARG GIT_SHORT_SHA="unknown"
ARG VERSION="unknown"
ARG BUILD_DATE="unknown"
RUN echo "GIT_SHORT_SHA=${GIT_SHORT_SHA}" > /etc/kegbot-version
RUN echo "VERSION=${VERSION}" >> /etc/kegbot-version
RUN echo "BUILD_DATE=${BUILD_DATE}" >> /etc/kegbot-version
RUN echo "GIT_SHORT_SHA=${GIT_SHORT_SHA}" \
&& echo "VERSION=${VERSION}" \
&& echo "BUILD_DATE=${BUILD_DATE}" /etc/kegbot-version

VOLUME ["/kegbot-data"]

Expand Down