Skip to content

Commit

Permalink
Attempt to build and tag the slim variant
Browse files Browse the repository at this point in the history
  • Loading branch information
crohr committed Aug 1, 2023
1 parent da91c8d commit f205686
Showing 1 changed file with 83 additions and 66 deletions.
149 changes: 83 additions & 66 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ permissions:
contents: read # to fetch code (actions/checkout)

env:
REGISTRY_IMAGE: openproject/community
REGISTRY_IMAGE: openproject/community-test

jobs:
build:
Expand All @@ -25,10 +25,17 @@ jobs:
matrix:
include:
- platform: linux/amd64
- platform: linux/ppc64le
bim_support: false
- platform: linux/arm64/v8
bim_support: false
target: slim
# - platform: linux/arm64/v8
# target: slim
- platform: linux/amd64
target: all-in-one
# - platform: linux/ppc64le
# bim_support: false
# target: all-in-one
# - platform: linux/arm64/v8
# bim_support: false
# target: all-in-one
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -56,6 +63,7 @@ jobs:
with:
context: .
platforms: ${{ matrix.platform }}
target: ${{ matrix.target }}
build-args: |
BIM_SUPPORT=${{ matrix.bim_support }}
pull: true
Expand All @@ -65,7 +73,7 @@ jobs:
- name: Test
# We only test the native container. If that fails the builds for the others
# will be cancelled as well.
if: matrix.platform == 'linux/amd64'
if: matrix.platform == 'linux/amd64' && matrix.target == 'all-in-one'
run: |
docker run \
--name openproject \
Expand All @@ -78,63 +86,72 @@ jobs:
docker logs openproject --tail 100
wget -O- --retry-on-http-error=503,502 --retry-connrefused http://localhost:8080/api/v3
# - name: Push image
# id: push
# uses: docker/build-push-action@v4
# with:
# context: .
# platforms: ${{ matrix.platform }}
# build-args: |
# BASE_PREFIX=${{ matrix.base_prefix }}
# BIM_SUPPORT=${{ matrix.bim_support }}
# labels: ${{ steps.meta.outputs.labels }}
# outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
# - name: Export digest
# run: |
# mkdir -p /tmp/digests
# digest="${{ steps.push.outputs.digest }}"
# touch "/tmp/digests/${digest#sha256:}"
# - name: Upload digest
# uses: actions/upload-artifact@v3
# with:
# name: digests
# path: /tmp/digests/*
# if-no-files-found: error
# retention-days: 1
# merge:
# runs-on: ubuntu-latest
# needs:
# - build
# steps:
# - name: Download digests
# uses: actions/download-artifact@v3
# with:
# name: digests
# path: /tmp/digests
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
# - name: Docker meta
# id: meta
# uses: docker/metadata-action@v4
# with:
# images: ${{ env.REGISTRY_IMAGE }}
# flavor: |
# latest=false
# tags: |
# type=semver,pattern={{version}}
# type=semver,pattern={{major}}.{{minor}}
# type=semver,pattern={{major}}
# type=raw,value=dev,enable={{is_default_branch}}
# - name: Login to Docker Hub
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# - name: Create manifest list and push
# working-directory: /tmp/digests
# run: |
# docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
# $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
# - name: Inspect image
# run: |
# docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
- name: Push image
id: push
uses: docker/build-push-action@v4
with:
context: .
platforms: ${{ matrix.platform }}
target: ${{ matrix.target }}
build-args: |
BIM_SUPPORT=${{ matrix.bim_support }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.push.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v3
with:
name: digests-${{ matrix.target }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
merge:
runs-on: ubuntu-latest
strategy:
matrix:
target: [slim, all-in-one]
needs:
- build
steps:
- name: Download digests
uses: actions/download-artifact@v3
with:
name: digests-${{ matrix.target }}
path: /tmp/digests
- name: Set prefix
id: set_prefix
run: |
prefix="-${{ matrix.target }}"
if [ "$prefix" = "-all-in-one" ]; then prefix = "" ; fi
echo "prefix=$prefix" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY_IMAGE }}
flavor: |
latest=false
tags: |
type=semver,pattern={{version}}${{ steps.set_prefix.outputs.prefix }}
type=semver,pattern={{major}}.{{minor}}${{ steps.set_prefix.outputs.prefix }}
type=semver,pattern={{major}}${{ steps.set_prefix.outputs.prefix }}
type=raw,value=dev${{ steps.set_prefix.outputs.prefix }},enable={{is_default_branch}}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}

0 comments on commit f205686

Please sign in to comment.