From d384bebb4c372a1fd5c30c696033d648ecdb7ed7 Mon Sep 17 00:00:00 2001 From: mesaj Date: Tue, 10 Jun 2025 19:14:23 +0200 Subject: [PATCH] Move Dockerfile from devops to the repo, base image Alpine Linux Change-Id: I61289b010a8616c1218ba3f4e14d9aca874e7d21 Signed-off-by: mesaj --- ci-images/tox/Dockerfile | 30 ++++++++++++++++++++++++++++++ ci-images/tox/entrypoint.sh | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 ci-images/tox/Dockerfile create mode 100755 ci-images/tox/entrypoint.sh diff --git a/ci-images/tox/Dockerfile b/ci-images/tox/Dockerfile new file mode 100644 index 00000000..99077978 --- /dev/null +++ b/ci-images/tox/Dockerfile @@ -0,0 +1,30 @@ +####################################################################################### +# Copyright ETSI Contributors and Others. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +####################################################################################### +FROM 31z4/tox + +USER root + +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends patch wget libmagic-dev; \ + rm -rf /var/lib/apt/lists/* + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] +CMD ["devops-stages/stage-test.sh"] diff --git a/ci-images/tox/entrypoint.sh b/ci-images/tox/entrypoint.sh new file mode 100755 index 00000000..072028b8 --- /dev/null +++ b/ci-images/tox/entrypoint.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +####################################################################################### +# Copyright ETSI Contributors and Others. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +####################################################################################### + +set -euo pipefail + +UID=${UID:-10000} +GID=${GID:-10000} + +# ensure group exists with given GID +if ! getent group "${GID}" > /dev/null; then + groupmod -o -g "${GID}" tox 2>/dev/null \ + || groupadd -o -g "${GID}" tox +fi + +# ensure tox user has the given UID +usermod -o -u "${UID}" -g "${GID}" tox \ + || useradd -o -m -u "${UID}" -g "${GID}" tox + +exec su tox "$@" -- 2.25.1