MT#57453 Switch docker image to bookworm

yarnpkg is no longer available in Debian/bookworm, while we already ship
a bundled yarnpkg. So use that bundled yarnpkg binary also within our
Docker related actions. Also see commit bd8a150825 and MT#55813 (and
related to MT#55391).

Use our yarn binary as /tmp/yarn within Docker (to have to maintain it
only at one place). While at it, switch Docker instructions from ADD to
COPY, quoting from
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#add-or-copy ->

  Although ADD and COPY are functionally similar, generally speaking, COPY is preferred.

Also, run pip3 install with --break-system-packages, to address new
PEP 668 specific behavior of pip3, as present in Debian/bookworm:

| error: externally-managed-environment
|
| × This environment is externally managed
| ╰─> To install Python packages system-wide, try apt install
|     python3-xyz, where xyz is the package you are trying to
|     install.
|
|     If you wish to install a non-Debian-packaged Python package,
|     create a virtual environment using python3 -m venv path/to/venv.
|     Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
|     sure you have python3-full installed.
|
|     If you wish to install a non-Debian packaged Python application,
|     it may be easiest to use pipx install xyz, which will manage a
|     virtual environment for you. Make sure you have pipx installed.
|
|     See /usr/share/doc/python3.11/README.venv for more information.
|
| note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
| hint: See PEP 668 for the detailed specification.

Change-Id: I09774d137925891a5f40e5597c40f48594f41d6f
mr12.0
Mykola Malkov 2 years ago committed by Michael Prokop
parent 6b6c9faac8
commit 6767abe0fa

@ -1,11 +1,11 @@
# DOCKER_NAME=ngcp-csc-ui-bullseye
FROM docker.mgm.sipwise.com/sipwise-bullseye:latest
# DOCKER_NAME=ngcp-csc-ui-bookworm
FROM docker.mgm.sipwise.com/sipwise-bookworm:latest
# Important! Update this no-op ENV variable when this Dockerfile
# is updated with the current date. It will force refresh of all
# of the base images and things like `apt-get update` won't be using
# old cached versions when the Dockerfile is built.
ENV REFRESHED_AT 2022-10-04
ENV REFRESHED_AT 2023-06-26
ENV NODE_PATH=/usr/lib/nodejs:/usr/share/nodejs
ENV DEBIAN_FRONTEND noninteractive
@ -19,17 +19,17 @@ RUN apt-get update && apt-get install --assume-yes --no-install-recommends \
g++ \
make \
nodejs \
python3 \
yarnpkg
python3
RUN echo "cd /code && ./t/testrunner" >/root/.bash_history
# we cannot use /code/ here otherwise it will be 'mounted over' with following 'docker run'
ADD package.json /tmp/
ADD yarn.lock /tmp/
ADD README.md /tmp/
COPY package.json /tmp/
COPY yarn.lock /tmp/
COPY .yarn/releases/yarn-1.22.19.js /tmp/yarn
COPY README.md /tmp/
WORKDIR /tmp
RUN yarnpkg install
RUN ./yarn install
WORKDIR /code
@ -41,16 +41,16 @@ WORKDIR /code
#
# you need to put the proper NGCP sources at t/sources.list.d/builddeps.list
# for instance, trunk:
# echo "deb https://deb.sipwise.com/autobuild/ release-trunk-bullseye main" > t/sources.list.d/builddeps.list
# echo "deb https://deb.sipwise.com/autobuild/ release-trunk-bookworm main" > t/sources.list.d/builddeps.list
#
# NOTE: run the following command from root folder of git repository:
# % docker build --tag="ngcp-csc-ui-bullseye" -f ./t/Dockerfile .
# % docker run --rm -i -t -v $(pwd):/code:ro ngcp-csc-ui-bullseye:latest bash
# % docker build --tag="ngcp-csc-ui-bookworm" -f ./t/Dockerfile .
# % docker run --rm -i -t -v $(pwd):/code:ro ngcp-csc-ui-bookworm:latest bash
#
# Use the existing docker image:
# % docker pull docker.mgm.sipwise.com/ngcp-csc-ui-bullseye
# % docker pull docker.mgm.sipwise.com/ngcp-csc-ui-bookworm
# NOTE: run the following command from root folder of git repository:
# % docker run --rm -i -t -v $(pwd):/code:ro -v /results docker.mgm.sipwise.com/ngcp-csc-ui-bullseye:latest bash
# % docker run --rm -i -t -v $(pwd):/code:ro -v /results docker.mgm.sipwise.com/ngcp-csc-ui-bookworm:latest bash
#
# Inside docker:
# cd /code && ./t/testrunner

@ -1,11 +1,11 @@
# DOCKER_NAME=ngcp-csc-ui-selenium-test-bullseye
FROM docker.mgm.sipwise.com/sipwise-bullseye:latest
# DOCKER_NAME=ngcp-csc-ui-selenium-test-bookworm
FROM docker.mgm.sipwise.com/sipwise-bookworm:latest
# Important! Update this no-op ENV variable when this Dockerfile
# is updated with the current date. It will force refresh of all
# of the base images and things like `apt-get update` won't be using
# old cached versions when the Dockerfile is built.
ENV REFRESHED_AT 2021-05-03
ENV REFRESHED_AT 2023-06-26
RUN apt-get update
RUN apt-get install --assume-yes \
@ -47,8 +47,8 @@ RUN wget http://deb.sipwise.com/files/firefox-70.0.1.tar.bz2 && \
RUN wget http://deb.sipwise.com/files/nose2-0.9.1.tar.gz && \
wget http://deb.sipwise.com/files/selenium-3.141.0.tar.gz && \
wget http://deb.sipwise.com/files/coverage-4.5.4.tar.gz && \
pip3 install coverage-4.5.4.tar.gz && \
pip3 install nose2-0.9.1.tar.gz selenium-3.141.0.tar.gz && \
pip3 install --break-system-packages coverage-4.5.4.tar.gz && \
pip3 install --break-system-packages nose2-0.9.1.tar.gz selenium-3.141.0.tar.gz && \
rm -f nose2-0.9.1.tar.gz selenium-3.141.0.tar.gz coverage-4.5.4.tar.gz
RUN echo "cd /code && ./t/selenium/testrunner 1.2.3.4 /code/ tap" >/home/selenium/.bash_history
@ -62,12 +62,12 @@ COPY t/selenium/jenkins_docker_run /home/selenium/
# ----------------------
# When you want to build the base image from scratch (jump to the next section if you don't want to build yourself!):
# NOTE: run the following command from root folder of git repository:
# % docker build --tag="ngcp-csc-ui-selenium-test-bullseye" -f t/selenium/Dockerfile .
# % docker run --rm -p 5999:5999 --shm-size 4g -i -t -v ~/Dokumente/ngcp-csc-ui:/code:rw ngcp-csc-ui-selenium-test-bullseye bash
# % docker build --tag="ngcp-csc-ui-selenium-test-bookworm" -f t/selenium/Dockerfile .
# % docker run --rm -p 5999:5999 --shm-size 4g -i -t -v ~/Dokumente/ngcp-csc-ui:/code:rw ngcp-csc-ui-selenium-test-bookworm bash
#
# Use the existing docker image:
# % docker pull docker.mgm.sipwise.com/ngcp-csc-ui-selenium-test-bullseye
# % docker run --rm -p 5999:5999 --shm-size 4g -i -t -v $(pwd):/code:rw docker.mgm.sipwise.com/ngcp-csc-ui-selenium-test-bullseye:latest bash
# % docker pull docker.mgm.sipwise.com/ngcp-csc-ui-selenium-test-bookworm
# % docker run --rm -p 5999:5999 --shm-size 4g -i -t -v $(pwd):/code:rw docker.mgm.sipwise.com/ngcp-csc-ui-selenium-test-bookworm:latest bash
#
# Inside docker:
# su - selenium

@ -16,7 +16,7 @@ cd /tmp/code/
echo "################################################################################"
echo "Finished main setup, now running tests ..."
yarnpkg test:unit
/tmp/yarn test:unit
echo "### Moving JUnit XML files to /results"
cp /tmp/code/junit.xml /results/

Loading…
Cancel
Save