Skip to content

Commit

Permalink
Merge pull request #40 from murraystevenson/podmanSquashAll
Browse files Browse the repository at this point in the history
Podman container
  • Loading branch information
murraystevenson authored Feb 22, 2024
2 parents b757c11 + 202c9fb commit 5189cef
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 8 deletions.
38 changes: 30 additions & 8 deletions .github/workflows/dockerImagePublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,45 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Build the Docker image
run: docker build . --file Dockerfile --tag image
- name: Free additional disk space
run: |
echo "Initial free space: "
df -h /
sudo rm -rf /usr/local/lib/android
echo "Removed Android SDK: "
df -h /
sudo rm -rf /usr/share/dotnet
echo "Removed .NET runtime: "
df -h /
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
echo "Tool cache cleanup: "
df -h /
sudo docker image prune --all --force
echo "Docker prune: "
df -h /
sudo apt remove -y '^llvm-.*-dev$' '^dotnet-.*' '^openjdk-.*' '.*-jdk$' firefox google-chrome-stable microsoft-edge-stable google-cloud-cli azure-cli mono-devel powershell
sudo apt autoremove -y
sudo apt clean
echo "Package cleanup: "
df -h /
- uses: actions/checkout@v4

- name: Build the container image
run: podman build . --file Dockerfile --tag image --squash-all

- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
run: echo "${{ secrets.GITHUB_TOKEN }}" | podman login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push image
run: |
# Image ID must be lowercase
IMAGE_ID=docker.pkg.github.com/$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')/$IMAGE_NAME
IMAGE_ID=ghcr.io/$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')/$IMAGE_NAME
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag image $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
podman tag image $IMAGE_ID:$VERSION
podman push $IMAGE_ID:$VERSION
9 changes: 9 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
3.0.0ax
=======

- Dockerfile : Removed `cuda-nsight-compute-11-8.x86_64`, `libcublas-devel-11-8-11.11.3.6-1.x86_64`, `sonar-scanner-4.8.0.2856-linux`, and various intermediate installation files to reduce container size.
- CI :
- Container image is now built with `podman` rather than `docker`.
- Container image is built with `--squash-all` in order to reduce overall container size.
- References to `docker.pkg.github.com` have been changed to `ghcr.io`.

3.0.0a5
=======

Expand Down
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,21 @@ RUN yum install -y 'dnf-command(versionlock)' && \
chmod a+x Inkscape-091e20e-x86_64.AppImage && \
./Inkscape-091e20e-x86_64.AppImage --appimage-extract && \
ln -s /opt/inkscape-1.3.2/squashfs-root/AppRun /usr/local/bin/inkscape && \
rm -f Inkscape-091e20e-x86_64.AppImage && \
cd - && \
#
# Trim out a few things we don't need. We inherited a lot more than we need from
# `aswf/ci-base`, and we run out of disk space on GitHub Actions if our container
# is too big. A particular offender is CUDA, which comes with all sorts of
# bells and whistles we don't need, and is responsible for at least 5Gb of the
# total image size.
rm -rf /var/opt/sonar-scanner-4.8.0.2856-linux && \
rm -rf /tmp/downloads && \
dnf remove -y \
cuda-nsight-compute-11-8.x86_64 \
libcublas-devel-11-8-11.11.3.6-1.x86_64 && \
dnf clean all && \
#
# Now we've installed all our packages, update yum-versionlock for all the
# new packages so we can copy the versionlock.list out of the container when we
# want to update the build env.
Expand Down

0 comments on commit 5189cef

Please sign in to comment.