Skip to content

Commit

Permalink
Use build contexts for passing between images
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisburr committed Nov 23, 2023
1 parent 284648c commit 29e07a6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 25 deletions.
46 changes: 23 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Enable containerd
run: |
cat /etc/docker/daemon.json | jq '. + {"experimental": true, "features": {"containerd-snapshotter": true}}' > daemon.json.new
sudo cp daemon.json.new /etc/docker/daemon.json
sudo systemctl restart docker.service
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand All @@ -63,38 +58,43 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push base

- name: Build base
id: build_base
uses: docker/build-push-action@v5
with:
load: true
context: base
push: ${{ github.event_name == 'push' && github.repository == 'DIRACGrid/container-images' && github.ref_name == 'main' }}
outputs: type=oci,dest=output-base.tar
tags: ghcr.io/diracgrid/diracx/base:latest
platforms: linux/amd64,linux/arm64
- name: Extract base
run: |
mkdir output-base
tar -C output-base -xf output-base.tar
- name: Build and push services-base
run: |
echo "CHRIS digets ${{steps.build_base.outputs.digest}}"
echo "CHRIS image_id ${{steps.build_base.outputs.imageid}}"
- name: Build and push services-base
uses: docker/build-push-action@v5
with:
context: services-base
load: true
push: ${{ github.event_name == 'push' && github.repository == 'DIRACGrid/container-images' && github.ref_name == 'main' }}
build-contexts: |
foo=oci-layout://output-base@${{steps.build_base.outputs.digest}}
outputs: type=oci,dest=output-services-base.tar
tags: ghcr.io/diracgrid/diracx/services-base:latest
platforms: linux/amd64,linux/arm64
build-args: BASE_IMAGE_DIGEST=${{steps.build_base.outputs.digest}}
- name: Build and push client-base
uses: docker/build-push-action@v5
with:
context: client-base
load: true
push: ${{ github.event_name == 'push' && github.repository == 'DIRACGrid/container-images' && github.ref_name == 'main' }}
tags: ghcr.io/diracgrid/diracx/client-base:latest
platforms: linux/amd64,linux/arm64
build-args: BASE_IMAGE_DIGEST=${{steps.build_base.outputs.digest}}



- name: Extract base
run: |
tar -C output-services-base -xf output-services-base.tar
# - name: Build and push client-base
# uses: docker/build-push-action@v5
# with:
# context: client-base
# push: ${{ github.event_name == 'push' && github.repository == 'DIRACGrid/container-images' && github.ref_name == 'main' }}
# tags: ghcr.io/diracgrid/diracx/client-base:latest
# platforms: linux/amd64,linux/arm64
# build-args: BASE_IMAGE_DIGEST=${{steps.build_base.outputs.digest}}
3 changes: 1 addition & 2 deletions services-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ARG BASE_IMAGE_DIGEST
FROM ghcr.io/diracgrid/diracx/base@${BASE_IMAGE_DIGEST}
FROM foo


# Copying in ENTRYPOINT script and environment specification
Expand Down

0 comments on commit 29e07a6

Please sign in to comment.