Skip to content

Docker Build and Push #39

Docker Build and Push

Docker Build and Push #39

Workflow file for this run

name: Docker Build and Push
on:
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
# Step 0: Set lowercase name
- name: Set lower case owner name
run: echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}
env:
OWNER: "${{ github.repository_owner }}"
# Step 1: Check out the code
- name: Checkout code
uses: actions/checkout@v4
# Step 2: Set up QEMU for cross-platform builds
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all
# Step 3: Set up Docker Buildx for multi-platform builds
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: image=moby/buildkit:latest
# Step 4: Log in to GitHub Container Registry (ghcr.io)
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Step 5: Build and push the multi-platform Docker image
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/${{ env.OWNER_LC }}/diffusors-fastapi-server:latest