mirror of
https://github.com/MrUnknownDE/bierkasten-casino.git
synced 2026-04-25 00:53:45 +02:00
add github workflow
This commit is contained in:
61
.github/workflows/docker-build.yml
vendored
Normal file
61
.github/workflows/docker-build.yml
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
# path: .github/workflows/docker-build.yml
|
||||
name: Build and Push Docker Images
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: docker.io
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU (for multi-arch builds)
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Set image names
|
||||
id: vars
|
||||
run: |
|
||||
echo "backend_image=${{ secrets.DOCKERHUB_USERNAME }}/bierbaron-backend" >> $GITHUB_OUTPUT
|
||||
echo "frontend_image=${{ secrets.DOCKERHUB_USERNAME }}/bierbaron-frontend" >> $GITHUB_OUTPUT
|
||||
echo "sha=${GITHUB_SHA}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build and push backend image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./backend
|
||||
file: ./backend/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
${{ steps.vars.outputs.backend_image }}:latest
|
||||
${{ steps.vars.outputs.backend_image }}:${{ steps.vars.outputs.sha }}
|
||||
|
||||
- name: Build and push frontend image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./frontend
|
||||
file: ./frontend/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
${{ steps.vars.outputs.frontend_image }}:latest
|
||||
${{ steps.vars.outputs.frontend_image }}:${{ steps.vars.outputs.sha }}
|
||||
Reference in New Issue
Block a user