Skip to content

Build Docker Image #186

Build Docker Image

Build Docker Image #186

Workflow file for this run

name: Build Docker Image
on:
push:
branches:
- main
schedule:
- cron: '0 5 * * *'
workflow_dispatch:
env:
DOCKER_HUB_USERNAME: 'marcusmu'
GITHUB_USERNAME_LOWERCASE: 'm-arcus'
IMAGE_NAME: 'php-codestyle-swissknife-docker'
permissions:
contents: read
packages: write
jobs:
base:
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install apko
uses: jaxxstorm/action-install-gh-release@v1.12.0
with:
repo: chainguard-dev/apko
tag: v0.13.2
binaries-location: apko_0.13.2_linux_amd64
- name: Login into Github Docker Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Login into Docker Hub
run: echo "${{ secrets.DOCKER_HUB_PAT }}" | docker login -u ${{ env.DOCKER_HUB_USERNAME }} --password-stdin
- name: Build base and push
run: apko publish wolfi-base.yaml ghcr.io/${{ env.GITHUB_USERNAME_LOWERCASE }}/${{ env.IMAGE_NAME }}:base
main-build:
needs: [ base ]
runs-on: ubuntu-latest
steps:
- name: Login into Github Docker Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Login into Docker Hub
run: echo "${{ secrets.DOCKER_HUB_PAT }}" | docker login -u ${{ env.DOCKER_HUB_USERNAME }} --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ env.DOCKER_HUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest
ghcr.io/${{ env.GITHUB_USERNAME_LOWERCASE }}/${{ env.IMAGE_NAME }}:latest