52 lines
1.5 KiB
YAML
52 lines
1.5 KiB
YAML
name: docker-monica-build development
|
|
|
|
on:
|
|
push:
|
|
branches-ignore:
|
|
- main # Läuft auf allen Branches außer `main`
|
|
|
|
jobs:
|
|
dockerfile_lint:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: hadolint/hadolint-action@v3.1.0
|
|
with:
|
|
dockerfile: Dockerfile
|
|
|
|
build:
|
|
needs: dockerfile_lint
|
|
runs-on: ubuntu-22.04
|
|
env:
|
|
DOCKER_HOST: tcp://dind-docker:2375
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Clean Branch Name
|
|
id: clean_branch_name
|
|
run: |
|
|
CLEANED_BRANCH_NAME=$(echo "${GITHUB_REF_NAME}" | tr '[:upper:]' '[:lower:]' | tr '/_' '-')
|
|
echo "CLEAN_BRANCH_NAME=${CLEANED_BRANCH_NAME}" >> $GITHUB_ENV
|
|
|
|
- name: Log in to registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: gitea.sikorski.cloud
|
|
username: rogersik
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Build and push Docker image with Buildx
|
|
run: |
|
|
# create builder instance manually (no driver-opts)
|
|
docker buildx create --name mybuilder --use || true
|
|
docker buildx inspect --bootstrap
|
|
|
|
# build and push
|
|
docker buildx build \
|
|
--platform linux/amd64,linux/arm64 \
|
|
--tag gitea.sikorski.cloud/rogersik/monica:${CLEAN_BRANCH_NAME} \
|
|
--cache-from=type=registry,ref=gitea.sikorski.cloud/rogersik/monica:cache \
|
|
--cache-to=type=registry,ref=gitea.sikorski.cloud/rogersik/monica:cache,mode=max \
|
|
--push \
|
|
.
|