Skip to content

Create Docker-image & CI #1

Create Docker-image & CI

Create Docker-image & CI #1

Workflow file for this run

name: Build Docker Images for GHCR
on:
push:
branches:
- main
jobs:
build-image:
name: Build Docker Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- Dockerfile: coffee-shop/coffee-maker/Dockerfile
context: coffee-shop/coffee-maker
tag: coffee-maker
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_PAT }} # Use the new secret here
- name: Checkout code
uses: actions/checkout@v4
- name: set repository name to lowercase
run: |
echo "reponame=${reponame,,}" >>${GITHUB_ENV}
env:
reponame: '${{ github.repository }}'
- name: Build and Push Docker Image
uses: docker/build-push-action@v6
with:
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/une-tasse-de.cafe/${{ env.reponame }}:${{ matrix.tag }}
platforms: linux/amd64,linux/arm64