Skip to content

Commit

Permalink
Cleanup & useradd -l (#95)
Browse files Browse the repository at this point in the history
* Fedora 37: Use python virtualenv

Avoid conflicts of python packages between pip and the Fedora system
by using a virtual environment.
The EDK2 dependencies are pre-installed too.

Signed-off-by: Oliver Steffen <[email protected]>

* Fedora 39: Use python virtualenv

Avoid conflicts of python packages between pip and the Fedora system
by using a virtual environment.
The EDK2 dependencies are pre-installed too.

Signed-off-by: Oliver Steffen <[email protected]>

* Ubuntu 22.04: Use python virtualenv

Avoid conflicts of python packages between pip and the Fedora system
by using a virtual environment.
The EDK2 dependencies are pre-installed too.

Signed-off-by: Oliver Steffen <[email protected]>

* Remove Ubuntu-20 image

Remove the Ubuntu 20.04 image, since the distribution is very
old and this image is not maintainable anymore.
Note: The existing image will still be available on ghcr.

The availble python version (3.9) is too old for current EDK2.
The edk2-pytools are not available for it:

$ python --version
Python 3.9.5

python -m pip install --upgrade -r pip-requirements.txt
ERROR: Ignored the following versions that require a different python version:
      0.19.0 Requires-Python >=3.10;
      0.19.1 Requires-Python >=3.10;
      0.19.2 Requires-Python >=3.10;
      0.19.3 Requires-Python >=3.10;
      0.19.4 Requires-Python >=3.10;
      0.19.5 Requires-Python >=3.10;
      0.19.6 Requires-Python >=3.10;
      0.19.7 Requires-Python >=3.10;
      0.19.8 Requires-Python >=3.10;
      0.19.9 Requires-Python >=3.10;
      0.20.0 Requires-Python >=3.10;
      0.21.2 Requires-Python >=3.10;
      0.21.3 Requires-Python >=3.10;
      0.21.4 Requires-Python >=3.10;
      0.21.5 Requires-Python >=3.10
ERROR: Could not find a version that satisfies the requirement edk2-pytool-library==0.20.04
  (from versions: 0.9.0, 0.9.1, 0.9.2, 0.10.0, 0.10.1, 0.10.2, 0.10.3, 0.10.4, 0.10.5,
  0.10.6, 0.10.7, 0.10.8, 0.10.9, 0.10.10, 0.10.11, 0.10.12, 0.10.13, 0.10.15, 0.11.0,
  0.11.1, 0.11.2, 0.11.4, 0.11.5, 0.11.6, 0.12.0, 0.12.1, 0.12.2, 0.13.0, 0.13.1, 0.14.0,
  0.14.1, 0.15.0, 0.15.1, 0.15.2, 0.15.3, 0.15.4, 0.16.0, 0.16.1, 0.16.2, 0.17.0, 0.18.0,
  0.18.1, 0.18.2)
ERROR: No matching distribution found for edk2-pytool-library==0.20.0

Signed-off-by: Oliver Steffen <[email protected]>

* Add -l (--no-log-init) to useradd commands to avoid creating huge files

Without the -l (--no-log-init) parameter when running useradd, it can
create huge /var/log/faillog and /var/log/lastlog files since it reserves
space for all users between 0 and the UID.

See docker/hub-feedback#2263 (comment)
for more information.

Signed-off-by: Rebecca Cran <[email protected]>

* Add missing `-o` useradd option

Add the missing `-o` flag on the `useradd` command in the
entrypoint scripts of the Fedora-37 and Ubuntu-22 images.

Signed-off-by: Oliver Steffen <[email protected]>

---------

Signed-off-by: Oliver Steffen <[email protected]>
Signed-off-by: Rebecca Cran <[email protected]>
Co-authored-by: Rebecca Cran <[email protected]>
  • Loading branch information
osteffenrh and bexcran authored Jun 6, 2024
1 parent 61a5955 commit 46802aa
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 341 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/Ubuntu-20.yaml

This file was deleted.

24 changes: 17 additions & 7 deletions Fedora-37/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,25 @@
# purpose image. It contains the toolchains for all supported architectures, and
# all build dependencies.
FROM registry.fedoraproject.org/fedora:37 AS build

# Preinstall python + dependencies as virtual environment
RUN dnf \
--assumeyes \
--nodocs \
--setopt=install_weak_deps=0 \
install \
python3 \
python3-virtualenv
RUN virtualenv /opt/venv
ENV VIRTUAL_ENV /opt/venv
ENV PATH /opt/venv/bin:$PATH
RUN pip install --upgrade pip \
-r "https://raw.githubusercontent.com/tianocore/edk2/master/pip-requirements.txt"


ARG GCC_VERSION=12.3.1-1.fc37
ARG GCC_VERSION_CROSS=12.2.1-2.fc37
ARG NASM_VERSION=2.15.05-3.fc37
ARG PYTHON_VERSION=3.11
ARG GCC_LOONGARCH64_URL="https://github.com/loongson/build-tools/releases/download/2022.09.06/loongarch64-clfs-6.3-cross-tools-c-only.tar.xz"
ARG CSPELL_VERSION=5.20.0
ARG MARKDOWNLINT_VERSION=0.31.0
Expand All @@ -33,6 +48,7 @@ RUN dnf \
acpica-tools \
dotnet-runtime-${DOTNET_VERSION} \
curl \
diffutils \
gcc-c++-${GCC_VERSION} \
gcc-${GCC_VERSION} \
gcc-aarch64-linux-gnu-${GCC_VERSION_CROSS} \
Expand All @@ -47,16 +63,10 @@ RUN dnf \
nuget \
nasm-${NASM_VERSION} \
https://github.com/PowerShell/PowerShell/releases/download/v${POWERSHELL_VERSION}/powershell-${POWERSHELL_VERSION}-1.rh.x86_64.rpm \
python${PYTHON_VERSION} \
python3-distutils-extra \
python3-pip \
python3-setuptools \
nodejs \
npm \
tar \
sudo
RUN alternatives --install /usr/bin/python python /usr/bin/python3 1
RUN pip install pip lcov_cobertura --upgrade

RUN mkdir -p /cross-tools/ && \
curl -L "${GCC_LOONGARCH64_URL}" | \
Expand Down
2 changes: 1 addition & 1 deletion Fedora-37/fedora37_dev_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ user_gid=$(stat -c "%g" "${EDK2_DOCKER_USER_HOME}")
groupadd "${EDK2_DOCKER_USER}" -f -o -g "${user_gid}"
#
# - Add the user.
useradd "${EDK2_DOCKER_USER}" -u "${user_uid}" -g "${user_gid}" \
useradd "${EDK2_DOCKER_USER}" -o -l -u "${user_uid}" -g "${user_gid}" \
-G wheel -d "${EDK2_DOCKER_USER_HOME}" -M -s /bin/bash

echo "${EDK2_DOCKER_USER}":tianocore | chpasswd
Expand Down
23 changes: 17 additions & 6 deletions Fedora-39/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@
# purpose image. It contains the toolchains for all supported architectures, and
# all build dependencies.
FROM registry.fedoraproject.org/fedora:39 AS build

# Preinstall python + dependencies as virtual environment
RUN dnf \
--assumeyes \
--nodocs \
--setopt=install_weak_deps=0 \
install \
python3 \
python3-virtualenv
RUN virtualenv /opt/venv
ENV VIRTUAL_ENV /opt/venv
ENV PATH /opt/venv/bin:$PATH
RUN pip install --upgrade pip \
-r "https://raw.githubusercontent.com/tianocore/edk2/master/pip-requirements.txt"


ARG CSPELL_VERSION=8.0.0
ARG MARKDOWNLINT_VERSION=0.37.0
ARG POWERSHELL_VERSION=7.4.0
Expand All @@ -29,6 +45,7 @@ RUN dnf \
acpica-tools \
dotnet-runtime-${DOTNET_VERSION} \
curl \
diffutils \
gcc-c++ \
gcc \
gcc-aarch64-linux-gnu \
Expand All @@ -44,16 +61,10 @@ RUN dnf \
nuget \
nasm \
https://github.com/PowerShell/PowerShell/releases/download/v${POWERSHELL_VERSION}/powershell-${POWERSHELL_VERSION}-1.rh.x86_64.rpm \
python3 \
python3-distutils-extra \
python3-pip \
python3-devel \
nodejs \
npm \
tar \
sudo
RUN alternatives --install /usr/bin/python python /usr/bin/python3 1
RUN pip install --upgrade pip lcov_cobertura setuptools

ENV GCC5_AARCH64_PREFIX /usr/bin/aarch64-linux-gnu-
ENV GCC5_ARM_PREFIX /usr/bin/arm-linux-gnu-
Expand Down
2 changes: 1 addition & 1 deletion Fedora-39/fedora39_dev_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ user_gid=$(stat -c "%g" "${EDK2_DOCKER_USER_HOME}")
groupadd "${EDK2_DOCKER_USER}" -f -o -g "${user_gid}"
#
# - Add the user.
useradd "${EDK2_DOCKER_USER}" -o -u "${user_uid}" -g "${user_gid}" \
useradd "${EDK2_DOCKER_USER}" -l -o -u "${user_uid}" -g "${user_gid}" \
-G wheel -d "${EDK2_DOCKER_USER_HOME}" -M -s /bin/bash

echo "${EDK2_DOCKER_USER}":tianocore | chpasswd
Expand Down
187 changes: 0 additions & 187 deletions Ubuntu-20/Dockerfile

This file was deleted.

21 changes: 0 additions & 21 deletions Ubuntu-20/Readme.md

This file was deleted.

22 changes: 0 additions & 22 deletions Ubuntu-20/init_edkrepo_conf.sh

This file was deleted.

Loading

0 comments on commit 46802aa

Please sign in to comment.