Skip to content

Commit

Permalink
refactor: Use debian-slim image instead of python image
Browse files Browse the repository at this point in the history
Some companies only have access to the general debian images,
not to Python images.

As we're installing kubectl and python, the debian image
also provides more flexibility.
  • Loading branch information
MoritzWeber0 committed Jul 26, 2023
1 parent a4f92ab commit 12ca4cb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors
# SPDX-License-Identifier: Apache-2.0

ARG BASE_IMAGE=python:3.11-bookworm
ARG BASE_IMAGE=debian:bookworm-slim
FROM $BASE_IMAGE

SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
Expand All @@ -16,6 +16,10 @@ RUN apt-get update && \
unzip \
libpq-dev \
curl \
python3 \
python3-pip \
python3-venv \
gnupg \
&& rm -rf /var/lib/apt/lists/*

ARG KUBECTL_APT_REMOTE=https://apt.kubernetes.io/
Expand All @@ -32,6 +36,14 @@ COPY . /tmp/backend
COPY .git_archival.txt /tmp/.git_archival.txt
COPY startup.sh /opt/.startup.sh

# Activate venv
RUN ln -s $(which python3.11) /usr/bin/python && \
ln -sf $(which python3.11) /usr/bin/python3 && \
python -m venv /opt/.venv
ENV _OLD_VIRTUAL_PATH="$PATH"
ENV VIRTUAL_ENV=/opt/.venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

WORKDIR /tmp/backend
RUN --mount=type=cache,id=capella-collaboration-backend-dependencies,target=/root/.cache/pip,sharing=locked \
pip install ".[psycopg2]"
Expand Down
2 changes: 1 addition & 1 deletion ci-templates/gitlab/image-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ variables:
GUACAMOLE_IMAGE_NAME: "capella/collab/guacamole"
DOCKER_BUILD_ARGS: "--no-cache"
DOCKER_BUILDKIT: "1"
BASE_IMAGE: "debian:bullseye"
BASE_IMAGE: "debian:bookworm"
KUBECTL_APT_REMOTE: "https://apt.kubernetes.io/"

default:
Expand Down

0 comments on commit 12ca4cb

Please sign in to comment.