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

Build Docker images for Ubuntu 22.04 and 24.04 #318

Merged
merged 10 commits into from
Jan 11, 2025
Merged
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
16 changes: 12 additions & 4 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,18 @@ jobs:
export DB_VERSION
echo "DB_VERSION=$DB_VERSION" >> "$GITHUB_ENV"

- name: Build Docker Image
- name: Build Docker Images
run: |
export NO_CACHE="${{ github.ref == 'refs/heads/main' }}"
DB="$DB_VERSION" make docker-build
Copy link
Contributor Author

Choose a reason for hiding this comment

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

DB="$DB_VERSION" didn't appear to be doing anything 🤔

UBUNTU_RELEASE=noble make docker-build
UBUNTU_RELEASE=jammy make docker-build

- name: Log in to registry
if: github.ref == 'refs/heads/main'
# This is where you will update the PAT to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push image
- name: Push images
if: github.ref == 'refs/heads/main'
run: |
IMAGE_ID="ghcr.io/${{ github.repository_owner }}/idris2-pack"
Expand All @@ -47,6 +48,13 @@ jobs:
# Strip git ref prefix from version
echo IMAGE_ID="$IMAGE_ID"
echo DB_VERSION="$DB_VERSION"
docker tag "$IMAGE_ID:latest" "$IMAGE_ID:$DB_VERSION"
docker tag "$IMAGE_ID:jammy" "$IMAGE_ID:$DB_VERSION-jammy"
docker tag "$IMAGE_ID:noble" "$IMAGE_ID:$DB_VERSION-noble"
docker tag "$IMAGE_ID:noble" "$IMAGE_ID:$DB_VERSION"
docker tag "$IMAGE_ID:noble" "$IMAGE_ID:latest"
docker push "$IMAGE_ID:latest"
docker push "$IMAGE_ID:jammy"
docker push "$IMAGE_ID:noble"
docker push "$IMAGE_ID:$DB_VERSION"
docker push "$IMAGE_ID:$DB_VERSION-jammy"
docker push "$IMAGE_ID:$DB_VERSION-noble"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ build/
micropack/libidris2_support.so
micropack/libidris2_support.dylib
.vscode/
.idea/
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#checkov:skip=CKV_DOCKER_3: we intend to use `root` user

FROM ubuntu:22.04 AS build
ARG ubuntu_release

FROM ubuntu:$ubuntu_release AS build

SHELL ["/bin/bash", "-c"]

Expand All @@ -23,7 +25,7 @@ ENV SCHEME=chezscheme

RUN make micropack SCHEME=$SCHEME

FROM ubuntu:22.04
FROM ubuntu:$ubuntu_release

# hadolint ignore=DL3008,DL3015
RUN apt-get update && apt-get install --yes gcc make chezscheme libgmp3-dev git && rm -rf /var/lib/apt/lists/*
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export LD_LIBRARY_PATH = micropack
export DYLD_LIBRARY_PATH = micropack

DOCKER_IMAGE = ghcr.io/stefan-hoeck/idris2-pack
UBUNTU_RELEASE ?= noble
NO_CACHE ?= false

.PHONY: micropack
Expand All @@ -22,8 +23,8 @@ install-lib:

.PHONY: docker-build
docker-build:
docker build --no-cache=${NO_CACHE} -t ${DOCKER_IMAGE}:latest .
docker build --build-arg ubuntu_release=${UBUNTU_RELEASE} --no-cache=${NO_CACHE} -t ${DOCKER_IMAGE}:${UBUNTU_RELEASE} .

.PHONY: docker-run
docker-run:
docker run --rm -it ${DOCKER_IMAGE}:latest /bin/bash
docker run --rm -it ${DOCKER_IMAGE}:${UBUNTU_RELEASE} /bin/bash
Loading