This commit is contained in:
Elio Bischof
2025-02-11 17:48:11 +01:00
parent 6f30c8a2ac
commit cc2f603a67
6 changed files with 85 additions and 49 deletions

75
.github/workflows/docker.yml vendored Normal file
View File

@@ -0,0 +1,75 @@
name: Docker
on:
push:
branches:
- main
- dev
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Cache turbo build setup
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: 'image=moby/buildkit:v0.11.6'
- name: Login
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKER_IMAGE }}
# generate Docker tags based on the following events/attributes
tags: type=sha
- name: Install dependencies
run: pnpm install
- name: Build for Docker
run: pnpm build:docker
- name: Build and Push Image
id: build
uses: docker/build-push-action@v5
timeout-minutes: 10
with:
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true