Skip to content
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
40 changes: 25 additions & 15 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,15 @@ on:
# release:
# types: [published]

concurrency: docker
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
base_image:
name: Build base image
runs-on: ubuntu-latest
runs-on: ubuntu-22.04-arm
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
build-mount-path: '/var/lib/docker/volumes'
root-reserve-mb: 512
swap-size-mb: 1024
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
Expand All @@ -35,13 +25,25 @@ jobs:
latest=false
tags: |
type=ref,prefix=base.pr-,event=pr
type=ref,prefix=base.br-,event=branch
type=semver,prefix=base.,pattern={{version}}
type=semver,prefix=base.,pattern={{major}}.{{minor}}
type=raw,prefix=base.,value=edge,enable={{is_default_branch}}
type=raw,prefix=base.,value=latest,enable=${{ github.event_name == 'release' }}

- name: Get major version
id: major_version
env:
version: ${{ steps.meta.outputs.version }}
run: |
if [[ ${version} != base* ]]; then
echo "version=${version%%.*}" >> "$GITHUB_OUTPUT"
fi

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm64,linux/amd64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -58,6 +60,9 @@ jobs:
uses: docker/build-push-action@v6
with:
file: ./Dockerfile.base
build-args: |
BASE_IMAGE_VERSION=${{ steps.major_version.outputs.version || '12' }}-slim
CI_DOCKER_VERSION=${{ steps.meta.outputs.version || github.sha }}
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
Expand All @@ -67,7 +72,7 @@ jobs:

vcdeps_images:
name: Build vc-deps images
runs-on: ubuntu-latest
runs-on: ubuntu-22.04-arm
needs: base_image
strategy:
fail-fast: false
Expand All @@ -83,6 +88,7 @@ jobs:
latest=false
tags: |
type=ref,prefix={{ matrix.type }}.pr-,event=pr
type=ref,prefix={{ matrix.type }}.br-,event=branch
type=semver,prefix={{ matrix.type }}.,pattern={{version}}
type=semver,prefix={{ matrix.type }}.,pattern={{major}}.{{minor}}
type=raw,prefix={{ matrix.type }}.,value=edge,enable={{is_default_branch}}
Expand All @@ -92,6 +98,8 @@ jobs:

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm64,linux/amd64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -108,6 +116,8 @@ jobs:
uses: docker/build-push-action@v6
with:
file: ./Dockerfile.{{ matrix.type }}
build-args: |
CI_DOCKER_VERSION=${{ steps.meta.outputs.version || github.sha }}
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
Expand Down
15 changes: 9 additions & 6 deletions Dockerfile.base
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Build args
ARG BASE_IMAGE_VERSION=12-slim
ARG CI_DOCKER_VERSION

FROM debian:bookworm-slim
FROM debian:$BASE_IMAGE_VERSION
LABEL org.opencontainers.image.authors="Seth Parker <c.seth.parker@uky.edu>"
LABEL org.opencontainers.image.title="ci-docker (base)"
LABEL org.opencontainers.image.description="Base system packages"
Expand All @@ -14,11 +15,14 @@ ENV CI_DOCKER_VERSION=$CI_DOCKER_VERSION
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8
ENV QT_PLUGIN_PATH=/usr/local/Qt-6.7.2/plugins
ENV QT_PLUGIN_PATH=/usr/local/Qt-6.10.0/plugins

# Install apt sources
RUN echo 'deb http://deb.debian.org/debian bookworm-backports main' > /etc/apt/sources.list.d/backports.list \
&& apt-get clean && apt-get -y update
RUN if [ "${BASE_IMAGE_VERSION}" = "12-slim" ]; then \
echo 'deb http://deb.debian.org/debian bookworm-backports main' > /etc/apt/sources.list.d/backports.list; \
export BACKPORTS_TAG="-t bookworm-backports"; \
fi \
&& apt-get clean && apt-get -y update
RUN apt-get install --fix-missing --fix-broken -y \
build-essential \
curl \
Expand Down Expand Up @@ -66,7 +70,7 @@ RUN apt-get install --fix-missing --fix-broken -y \
zlib1g-dev \
&& ln -s /usr/bin/python3 /usr/bin/python \
&& sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen \
&& apt-get -t bookworm-backports install -y cmake \
&& apt-get ${BACKPORTS_TAG} install -y cmake \
&& apt-get purge && rm -rf /var/lib/apt/lists/*

# Install Qt6
Expand All @@ -80,5 +84,4 @@ RUN curl -O -L https://download.qt.io/archive/qt/6.7/6.7.2/single/qt-everywhere-
&& rm -rf qt-*

# Start an interactive shell
ENTRYPOINT ["/bin/bash", "-c"]
CMD ["echo ci-docker $CI_DOCKER_TYPE.$CI_DOCKER_VERSION"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ for [semantic versioning](https://semver.org/):
# build.sh
VER_MAJOR=12
VER_MINOR=1
VER_PATCH=1
VER_PATCH=2
```

### Version rules
Expand All @@ -62,7 +62,7 @@ VER_PATCH=1
- Increment `VER_MINOR`
- Set `VER_PATCH=0`

#### Updating vc-deps to a new minor version
#### Updating vc-deps to a new major or minor version
- Checkout the appropriate ref in the vc-deps directory
- Increment `VER_MINOR`
- Set `VER_PATCH=0`
Expand Down
14 changes: 10 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ timestamp() {
REPO=ghcr.io/educelab/ci-docker
VER_MAJOR=12
VER_MINOR=1
VER_PATCH=1
VER_PATCH=2
VER_EXTRA=
VER_FULL=${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}${VER_EXTRA}
BASE_IMAGE_VERSION=${VER_MAJOR}-slim
REV=$(git rev-parse --verify HEAD)

PLATFORMS="linux/amd64,linux/arm64"
TYPES=(base dynamic static)
PUSH="--push"

labels() {
echo --label org.opencontainers.image.created=$(timestamp) \
--label org.opencontainers.image.licenses=AGPL-3.0 \
Expand All @@ -36,15 +41,16 @@ tags() {
echo "${TAGS}"
}

for TYPE in base dynamic static; do
for TYPE in "${TYPES[@]}"; do
echo ========== Building ${TYPE} image ==========
docker buildx build \
-f Dockerfile.${TYPE} \
--platform linux/amd64,linux/arm64 \
--platform ${PLATFORMS} \
--build-arg BASE_IMAGE_VERSION=${BASE_IMAGE_VERSION} \
--build-arg CI_DOCKER_VERSION=${VER_FULL} \
--provenance false \
$(labels) \
$(tags ${TYPE}) \
--push \
$PUSH \
.
done