Skip to content

Commit

Permalink
Enable CI via Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
dfunkt committed May 1, 2024
1 parent 842f67d commit 7ad170a
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/build-and-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build Docker Image

on:
push:
branches: [main, test]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
matrix:
base_image: [alpine, debian]

permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Determine Base Tags
shell: bash
run: |
if [[ "${{ github.ref_name }}" == "main" ]]; then
echo "BASE_TAGS=latest" | tee -a "${GITHUB_ENV}"
else
echo "BASE_TAGS=${{ github.ref_name }}" | tee -a "${GITHUB_ENV}"
fi
- name: Bake ${{ matrix.base_image }} containers
uses: docker/bake-action@v4
env:
BASE_TAGS: "${{ env.BASE_TAGS }}"
CONTAINER_REGISTRIES: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
SOURCE_REPOSITORY_URL: "${{ github.server_url }}/${{ github.repository }}"
SOURCE_VERSION: ${{ github.sha }}
VW_VERSION: ${{ github.sha }}
with:
push: true
files: docker/docker-bake.hcl
targets: ${{ matrix.base_image }}-multi
set: |
*.platform=linux/amd64,linux/arm64
*.cache-from=type=gha
*.cache-to=type=gha,mode=max

0 comments on commit 7ad170a

Please sign in to comment.