Skip to content

Commit

Permalink
wip docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
csparker247 committed Dec 14, 2023
1 parent 67910b0 commit bc24b35
Showing 1 changed file with 98 additions and 0 deletions.
98 changes: 98 additions & 0 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Build Docker image
on:
push:
branches: ["main", "release-12_v1"]
tags: ["v*"]

concurrency: docker

jobs:
base_image:
name: Build Docker image
runs-on: ubuntu-latest
steps:
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/educelab/ci-docker
flavor: |
latest=false
tags: |
type=ref,prefix="base.",event=pr
type=semver,prefix="base.",pattern={{version}}
type=semver,prefix="base.",pattern={{major}}.{{minor}}
type=raw,prefix="base.",value=edge,enable={{is_default_branch}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build base image
uses: docker/build-push-action@v3
with:
file: ./Dockerfile.base
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-to: type=gha,mode=max
cache-from: type=gha

vcdeps_images:
name: Build Docker image
runs-on: ubuntu-latest
needs: base_image
strategy:
fail-fast: false
matrix:
type: ["static", "dynamic"]
steps:
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/educelab/ci-docker
flavor: |
latest=false
tags: |
type=ref,prefix="{{ matrix.type }}.",event=pr
type=semver,prefix="{{ matrix.type }}.",pattern={{version}}
type=semver,prefix="{{ matrix.type }}.",pattern={{major}}.{{minor}}
type=raw,value=edge,enable={{is_default_branch}}
type=raw,value=latest,enable={{ matrix.type == 'static' }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build base image
uses: docker/build-push-action@v3
with:
file: ./Dockerfile.{{ matrix.type }}
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-to: type=gha,mode=max
cache-from: type=gha

0 comments on commit bc24b35

Please sign in to comment.