CI: add GitHub Actions workflow to build and push Docker image
Build and Push Docker Image / build-and-push (push) Has been cancelled
Build and Push Docker Image / build-and-push (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Log in to registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: docker.citysensor.de
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Read package version
|
||||
id: ver
|
||||
run: |
|
||||
echo "VERSION=$(node -p \"require('./package.json').version\")" >> $GITHUB_ENV
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: |
|
||||
docker.citysensor.de/logbuch:${{ env.VERSION }}
|
||||
docker.citysensor.de/logbuch:latest
|
||||
|
||||
- name: Done
|
||||
run: echo "Pushed docker.citysensor.de/logbuch:${{ env.VERSION }}"
|
||||
|
||||
# Secrets required in the repository settings:
|
||||
# - DOCKER_USERNAME
|
||||
# - DOCKER_PASSWORD
|
||||
Reference in New Issue
Block a user