Skip to content
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
8 changes: 4 additions & 4 deletions tests/performance/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ config: ## Create config for your locust tests
@uv run locust_settings.py $(input) | tee "${ENV_FILE}"


.PHONY: build push
build: ## Build test image
docker build -t ${TEST_IMAGE_NAME}:${TEST_IMAGE_TAG} ./docker
.PHONY: build-test-image push-test-image
build-test-image: _check_venv_active ## Build test image
docker build --build-arg PYTHON_VERSION="$(shell python --version | cut -d' ' -f2)" --build-arg UV_VERSION="$(shell uv --version | cut -d' ' -f2)" -t ${TEST_IMAGE_NAME}:${TEST_IMAGE_TAG} ./docker

push: ## Push test image to dockerhub
push-test-image: ## Push test image to dockerhub
docker push ${TEST_IMAGE_NAME}:${TEST_IMAGE_TAG}
53 changes: 5 additions & 48 deletions tests/performance/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,46 +1,13 @@
# syntax=docker/dockerfile:1

ARG PYTHON_VERSION="3.11.9"
ARG UV_VERSION="0.5"
FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv_build
FROM python:${PYTHON_VERSION}-slim-bookworm AS base

FROM cruizba/ubuntu-dind:latest AS base
ARG PYTHON_VERSION
LABEL maintainer=bisgaard-itis

# NOTE: to list the latest version run `make` inside `scripts/apt-packages-versions`
ENV DOCKER_APT_VERSION="5:26.1.4-1~debian.12~bookworm"

# -------------------------- Install docker -------------------
# for docker apt caching to work this needs to be added: [https://vsupalov.com/buildkit-cache-mount-dockerfile/]
RUN rm -f /etc/apt/apt.conf.d/docker-clean && \
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
RUN --mount=type=cache,target=/var/cache/apt,sharing=private \
set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
gosu \
ca-certificates \
curl \
gnupg \
lsb-release \
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
# only the cli is needed and we remove the unnecessary stuff again
docker-ce-cli=${DOCKER_APT_VERSION} \
&& apt-get remove -y\
gnupg \
curl \
lsb-release \
&& apt-get clean -y\
# verify that the binary works
&& gosu nobody true

# Sets utf-8 encoding for Python et al
ENV LANG=C.UTF-8
ENV UV_PYTHON=${PYTHON_VERSION}

# Turns off writing .pyc files; superfluous on an ephemeral container.
ENV PYTHONDONTWRITEBYTECODE=1 \
Expand All @@ -50,27 +17,17 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
# those from our virtualenv.
ENV PATH="${VIRTUAL_ENV}/bin:$PATH"


# -------------------------- Build stage -------------------
# Installs build/package management tools and third party dependencies
#
# + /build WORKDIR
#
FROM base AS build

ENV SC_BUILD_TARGET=build

RUN --mount=type=cache,target=/var/cache/apt,sharing=private \
set -eux \
&& apt-get update \
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
curl \
git \
jq

# install UV https://docs.astral.sh/uv/guides/integration/docker/#installing-uv
COPY --from=uv_build /uv /uvx /bin/
COPY --from=ghcr.io/astral-sh/uv:0.4 /uv /uvx /bin/

RUN uv venv "${VIRTUAL_ENV}"

Expand Down
Loading