Skip to content

Commit

Permalink
Update Ubuntu, Python, Python packages and PowerShell (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattclay authored Jun 10, 2024
1 parent f5a72e6 commit 3734abc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
18 changes: 10 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/bedrock/ubuntu:jammy-20240227
FROM quay.io/bedrock/ubuntu:noble-20240530

# Prevent automatic apt cache cleanup, as caching is desired when running integration tests.
# Instead, when installing packages during container builds, explicit cache cleanup is required.
Expand All @@ -25,10 +25,8 @@ RUN apt-get update -y && \
openssh-server \
openssl \
python-is-python3 \
python3.10-dev \
python3.10-venv \
python3.11-dev \
python3.11-venv \
python3.12-dev \
python3.12-venv \
shellcheck \
sudo \
systemd-sysv \
Expand All @@ -51,15 +49,19 @@ RUN apt-get update -y && \
python3.8-venv \
python3.9-dev \
python3.9-venv \
python3.12-dev \
python3.12-venv \
python3.10-dev \
python3.10-venv \
python3.11-dev \
python3.11-venv \
python3.13-dev \
python3.13-venv \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Install PowerShell using a binary archive.
# This allows pinning to a specific version, and also brings support for multiple architectures.
RUN version="7.4.0" && \
RUN version="7.4.2" && \
major_version="$(echo ${version} | cut -f 1 -d .)" && \
install_dir="/opt/microsoft/powershell/${major_version}" && \
tmp_file="/tmp/powershell.tgz" && \
Expand Down
4 changes: 2 additions & 2 deletions files/deadsnakes.list
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
deb [signed-by=/etc/apt/keyrings/deadsnakes.gpg] http://ppa.launchpad.net/deadsnakes/ppa/ubuntu jammy main
deb-src [signed-by=/etc/apt/keyrings/deadsnakes.gpg] http://ppa.launchpad.net/deadsnakes/ppa/ubuntu jammy main
deb [signed-by=/etc/apt/keyrings/deadsnakes.gpg] http://ppa.launchpad.net/deadsnakes/ppa/ubuntu noble main
deb-src [signed-by=/etc/apt/keyrings/deadsnakes.gpg] http://ppa.launchpad.net/deadsnakes/ppa/ubuntu noble main
10 changes: 5 additions & 5 deletions files/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ class Pip:
)

_DEFAULT_PACKAGES = dict(
pip='23.1.2',
setuptools='67.7.2',
wheel='0.37.1',
pip='24.0',
setuptools='70.0.0',
wheel='0.43.0',
)

_PACKAGES: dict[str, dict[str, str]] = {
Expand Down Expand Up @@ -90,7 +90,7 @@ def setup(self):
packages = [f'{name}=={version}' for name, version in self.packages.items()]

with self._install_options_context() as options:
subprocess.run(self._pip_command + options + list(self._OPTIONS) + packages, check=True, env=env)
subprocess.run(self._pip_command + options + list(self._OPTIONS) + ['--break-system-packages'] + packages, check=True, env=env)

def show_version(self) -> None:
"""Show the pip version."""
Expand All @@ -108,7 +108,7 @@ def wheel(self, args: t.List[str], constraints: pathlib.Path) -> None:
def install(self, args: t.List[str]) -> None:
"""Install Python packages."""
with self._install_options_context() as options:
subprocess.run(self._pip_command + ['install'] + options + list(self._OPTIONS) + args, check=True)
subprocess.run(self._pip_command + ['install', '--break-system-packages'] + options + list(self._OPTIONS) + args, check=True)

def list(self) -> t.List[t.Tuple[str, str]]:
"""Get a list of installed Python packages and versions."""
Expand Down

0 comments on commit 3734abc

Please sign in to comment.