Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update all docker-images to Debian Bookworm (latest stable) #2723

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
24 changes: 14 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,18 @@
# be world-readable!
#
#
FROM --platform=linux/amd64 debian:bullseye
FROM --platform=linux/amd64 python:3.11-slim-bookworm

#### Prepare the OS base setup ###

ENV DEBIAN_FRONTEND noninteractive

RUN echo 'deb-src http://deb.debian.org/debian bullseye main' >> /etc/apt/sources.list.d/srcpkg.list && \
echo 'deb-src http://security.debian.org/debian-security bullseye-security main' >> /etc/apt/sources.list.d/srcpkg.list
RUN apt-get update && \
apt-get -y --no-install-recommends install \
locales \
python3-dbg gdb \
sudo python3-dev python3-pip python3-virtualenv build-essential supervisor \
debian-keyring debian-archive-keyring ca-certificates curl gpg
debian-keyring debian-archive-keyring ca-certificates curl gpg

## Use deb.nodesource.com to fetch more modern versions of Node/NPM than Debian can provide
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource.gpg && \
Expand All @@ -55,6 +53,8 @@ RUN echo "${TIMEZONE}" > /etc/timezone && cp /usr/share/zoneinfo/${TIMEZONE} /et

RUN apt-get update \
&& apt-get -y --no-install-recommends install \
build-essential \
supervisor \
git-core \
libsnmp40 \
cron \
Expand All @@ -76,10 +76,18 @@ RUN apt-get update \
iputils-ping \
snmp

ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
Comment on lines +79 to +81
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I don't think you need any of this virtualenv f**kery when working from the python images at Dockerhub. They don't use the Debian-provided python/pip, so PEP 668 doesn't seem to apply here.

In fact, I can't get NAV to start properly in this bookworm-based image unless I delete these three lines.

I'd be glad to see this go, as I don't see the point of mixing virtualenvs into containers (unless you, for some silly reason, actually need multiples of them within a single container)


RUN adduser --system --group --no-create-home --home=/source --shell=/bin/bash nav
RUN mkdir -p /source && echo "export PATH=$PATH" >> /source/.bashrc

RUN pip install --upgrade 'setuptools>=61' wheel && \
pip install --upgrade pip pip-tools build

RUN pip3 install --upgrade 'setuptools>=61' wheel && \
pip3 install --upgrade 'pip<=23.1.0' pip-tools build
ARG CUSTOM_PIP=ipython
RUN pip install ${CUSTOM_PIP}

#################################################################################
### COPYing the requirements file to pip-install Python requirements may bust ###
Expand All @@ -94,13 +102,9 @@ COPY requirements.txt /
COPY constraints.txt /
COPY tests/requirements.txt /test-requirements.txt
COPY doc/requirements.txt /doc-requirements.txt
# Since we used pip3 to install pip globally, pip should now be for Python 3
RUN pip-compile --resolver=backtracking --output-file /requirements.txt.lock -c /constraints.txt /requirements.txt /test-requirements.txt /doc-requirements.txt
RUN pip install -r /requirements.txt.lock

ARG CUSTOM_PIP=ipython
RUN pip install ${CUSTOM_PIP}

COPY tools/docker/full-nav-restore.sh /usr/local/sbin/full-nav-restore.sh

# Set up for mounting live source code from git repo at /source
Expand Down
5 changes: 3 additions & 2 deletions tools/docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ if [[ ! -f "/source/setup.py" ]]; then
fi

cd /source
sudo -u nav python3 -m build

sudo -u nav env PATH=$PATH python3 -m build
pip install -e .
sudo -u nav python3 setup.py build_sass
sudo -u nav env PATH=$PATH python3 setup.py build_sass

if [[ ! -f "/etc/nav/nav.conf" ]]; then
echo "Copying initial NAV config files into this container"
Expand Down
6 changes: 3 additions & 3 deletions tools/docker/doc-watch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
#
cd /source
# Build once first
sudo -u nav python3 -m build # ensure build data and .eggs aren't stored as root
sudo -u nav env PATH=$PATH python3 -m build # ensure build data and .eggs aren't stored as root
pip install -e .
sudo -u nav sphinx-build doc/ build/sphinx/html/
sudo -u nav env PATH=$PATH sphinx-build doc/ build/sphinx/html/
# Then re-build on any changes to the doc directory
while inotifywait -e modify -e move -e create -e delete -r --exclude \# /source/doc /source/NOTES.rst
do
sudo -u nav sphinx-build doc/ build/sphinx/html/
sudo -u nav env PATH=$PATH sphinx-build doc/ build/sphinx/html/
done
6 changes: 1 addition & 5 deletions tools/docker/graphite/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
FROM debian:buster
FROM debian:bookworm

#### Prepare the OS base setup ###

ENV DEBIAN_FRONTEND noninteractive

RUN echo 'deb-src http://deb.debian.org/debian buster main' >> /etc/apt/sources.list.d/srcpkg.list && \
echo 'deb-src http://security.debian.org/debian-security buster/updates main' >> /etc/apt/sources.list.d/srcpkg.list && \
echo 'deb-src http://deb.debian.org/debian buster-updates main' >> /etc/apt/sources.list.d/srcpkg.list

RUN apt-get update && \
apt-get -y --no-install-recommends install \
locales \
Expand Down
2 changes: 1 addition & 1 deletion tools/docker/syncdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
cd /source
export PGHOST=postgres PGUSER=postgres
psql -l -t | grep -q '^ *nav' || navsyncdb -c
sudo -u nav navsyncdb -o
sudo -u nav env PATH=$PATH navsyncdb -o
2 changes: 1 addition & 1 deletion tools/forward/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM debian:bullseye
FROM debian:bookworm
RUN apt-get update && apt-get install -y openssh-server socat sudo tini
RUN echo '%adm ALL=NOPASSWD: /usr/bin/socat' > /etc/sudoers.d/socat
RUN chmod 0440 /etc/sudoers.d/socat
Expand Down
Loading