Skip to content
Draft
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
133 changes: 120 additions & 13 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,128 @@ on:

jobs:

get-build-time:
runs-on: "ubuntu-latest"
outputs:
seconds: ${{ steps.epoch.outputs.seconds }}

steps:
- name: Get epoch seconds
id: epoch
run: |
s=$(date +%s)
echo "seconds=${s}" >> ${GITHUB_OUTPUT}

build:
needs: [get-build-time]
strategy:
matrix:
platform:
- arch: "arm64"
runs_on: "ubuntu-24.04-arm"
- arch: "amd64"
runs_on: "ubuntu-latest"
product:
- context: "cadc-java"
- context: "cadc-tomcat"
# - context: "cadc-postgresql-dev" # Requires pgsphere rpm
# (no aarch64 RPM is currently built)
- context: "cadc-haproxy-dev"
runs-on: ${{ matrix.platform.runs_on }}
env:
tag: ${{ matrix.product.context == 'cadc-java' && 'cadc-tomcat' || matrix.product.context }}
DOCKER_CONTENT_TRUST: 1
seconds: ${{ needs.get-build-time.outputs.seconds }}

steps:
- name: Check out sources
uses: actions/checkout@v5

- name: Setup buildx
uses: docker/setup-buildx-action@v3
with:
name: builder-${{ matrix.platform.arch }}-${{ matrix.product.context }}
platforms: linux/${{ matrix.platform.arch }}

- name: Log in to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build container
uses: docker/build-push-action@v6
with:
context: ${{ matrix.product.context }}
builder: builder-${{ matrix.platform.arch }}-${{ matrix.product.context }}
cache-from: "type=gha"
cache-to: "type=gha,mode=max"
# Change tags for CADC push target: this is for lsst-sqre
# Presumably images.opencadc.org/library/${{ matrix.product.context }}-${{ matrix.platform.arch }}:<version>
tags: ghcr.io/${{ github.repository }}-${{ matrix.product.context }}-${{ matrix.platform.arch }}:${{ env.seconds }}
push: true

unify:
needs: [get-build-time,build]
runs-on: ubuntu-latest
env:
seconds: ${{ needs.get-build-time.outputs.seconds }}
strategy:
matrix:
product:
- "cadc-java"
- "cadc-tomcat"
# - "cadc-postgresql-dev" # Requires pgsphere RPM (no aarch64)
- "cadc-haproxy-dev"

steps:
- name: Log in to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Unify manifests
uses: Noelware/docker-manifest-action@v1
with:
inputs: ghcr.io/${{ github.repository }}-${{ matrix.product }}-amd64:${{ env.seconds }},ghcr.io/${{ github.repository }}-${{ matrix.product }}-arm64:${{ env.seconds }}
tags: ghcr.io/${{ github.repository }}-${{ matrix.product }}:${{ env.seconds }}

build-cadc-postgresql-dev:
# Once there is a pgsphere RPM for aarch64, we can reintegrate this
# into the matrix above.
needs: [get-build-time]
runs-on: ubuntu-latest
env:
seconds: ${{ needs.get-build-time.outputs.seconds }}

steps:
- uses: actions/checkout@v1

- name: Build cadc-java
run: cd cadc-java && DOCKER_CONTENT_TRUST=1 docker build . --file Dockerfile --tag cadc-tomcat:$(date +%s)

- name: Build cadc-tomcat
run: cd cadc-tomcat && DOCKER_CONTENT_TRUST=1 docker build . --file Dockerfile --tag cadc-tomcat:$(date +%s)

- name: Build cadc-postgresql-dev
run: cd cadc-postgresql-dev && DOCKER_CONTENT_TRUST=1 docker build . --file Dockerfile --tag cadc-postgresql-dev:$(date +%s)

- name: Build cadc-haproxy-dev
run: cd cadc-haproxy-dev && DOCKER_CONTENT_TRUST=1 docker build . --file Dockerfile --tag cadc-haproxy-dev:$(date +%s)
- name: Check out sources
uses: actions/checkout@v5

- name: Setup buildx
uses: docker/setup-buildx-action@v3
with:
name: builder-amd64-cadc-postgresql-dev
platforms: linux/amd64

- name: Log in to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build container
uses: docker/build-push-action@v6
with:
context: cadc-postgresql-dev
builder: builder-amd64-cadc-postgresql-dev
cache-from: "type=gha"
cache-to: "type=gha,mode=max"
# Change tags for CADC push target: this is for lsst-sqre
# Presumably images.opencadc.org/library/cadc-postgresql-dev:<version>
tags: ghcr.io/${{ github.repository }}-cadc-postgresql-dev:${{ env.seconds }}
push: true
2 changes: 2 additions & 0 deletions cadc-postgresql-dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ ARG PGSERVER="postgresql15-server postgresql15-contrib"
ARG PGSPHERE=https://ws-cadc.canfar.net/vault/files/pdowler/rpms/pgsphere15-1.4.2-1.fc42.x86_64.rpm

# install repositories, server, extensions
# But first create /var/lib/pgsql because ${PGDG} expects it to exist.
RUN mkdir -p /var/lib/pgsql && chown 26:26 /var/lib/pgsql
RUN dnf -y install ${PGDG} \
&& dnf -y install ${PGSERVER} ${PGSPHERE} \
&& dnf -y clean all
Expand Down