Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
11 changes: 11 additions & 0 deletions tests/performance/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ KERNEL_NAME=$(shell uname -s)

NETWORK_NAME=dashboards_timenet

TEST_IMAGE_NAME := itisfoundation/performance-tests
TEST_IMAGE_TAG := v0

# UTILS
# NOTE: keep short arguments for `cut` so it works in both BusyBox (alpine) AND Ubuntu
get_my_ip := $(shell (hostname --all-ip-addresses || hostname -i) 2>/dev/null | cut -d " " -f 1)
Expand Down Expand Up @@ -88,3 +91,11 @@ install-ci:
config: ## Create config for your locust tests
@$(call check_defined, input, please define inputs when calling $@ - e.g. ```make $@ input="--help"```)
@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

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

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

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

# Turns off writing .pyc files; superfluous on an ephemeral container.
ENV PYTHONDONTWRITEBYTECODE=1 \
VIRTUAL_ENV=/home/scu/.venv

# Ensures that the python and pip executables used in the image will be
# 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 \
&& 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/

RUN uv venv "${VIRTUAL_ENV}"

RUN --mount=type=cache,target=/root/.cache/uv \
uv pip install --upgrade \
wheel \
setuptools

WORKDIR /test
1 change: 1 addition & 0 deletions tests/performance/requirements/_base.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
locust-plugins
parse
pydantic
pydantic-settings
1 change: 0 additions & 1 deletion tests/performance/requirements/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
--requirement _base.txt
locust-plugins
Loading