Skip to content

Commit

Permalink
Simplify the docker build, and properly build a multiplatform image w…
Browse files Browse the repository at this point in the history
…ith docker build actions
  • Loading branch information
podhrmic committed Nov 5, 2024
1 parent dee4dcb commit 3d9a7b6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 56 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ concurrency:
group: docker-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

# Instructions from https://depot.dev/blog/multi-platform-docker-images-in-github-actions
jobs:
deploy-docker:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux/amd64, linux/arm64]
permissions:
packages: write
contents: read
Expand All @@ -40,11 +38,13 @@ jobs:
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build the Docker image
run: |
echo "Building ${{env.CERBERUS_IMAGE_ID}}"
PLATFORM=${{ matrix.platform }} make -f Makefile_docker release_cn
docker tag cn:release ${{env.CERBERUS_IMAGE_ID}}

- name: Push the Docker image
run: docker push ${{env.CERBERUS_IMAGE_ID}}
- name: Build multi-platform image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{env.CERBERUS_IMAGE_ID}}
cache-from: type=gha
cache-to: type=gha,mode=max
10 changes: 8 additions & 2 deletions Dockerfile.deps → Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM ubuntu:22.04
# Build image with all dependencies
FROM ubuntu:22.04 as deps

RUN apt-get update
RUN apt-get upgrade -y
Expand All @@ -15,4 +16,9 @@ RUN eval `opam env` \
&& make install \
&& make install_cn

WORKDIR /opt
WORKDIR /opt

COPY docker_entry_point.sh /opt/docker_entry_point.sh
RUN chmod +x /opt/docker_entry_point.sh
WORKDIR /data
ENTRYPOINT ["/opt/docker_entry_point.sh"]
15 changes: 0 additions & 15 deletions Dockerfile.dev-env

This file was deleted.

7 changes: 0 additions & 7 deletions Dockerfile.release

This file was deleted.

22 changes: 0 additions & 22 deletions Makefile_docker

This file was deleted.

0 comments on commit 3d9a7b6

Please sign in to comment.