Remove not needed repos and try different build cache. #148
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image | |
on: | |
push: | |
branches: | |
- 'master' | |
- 'dev' | |
tags: | |
- 'v*' | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- | |
name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ipbhalle/metfragweb | |
tags: | | |
# tag event | |
type=ref,event=tag | |
# set latest tag for main branch and tags | |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }} | |
# set dev tag for dev branch | |
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev'}} | |
- | |
name: Go Build Cache for Docker | |
uses: actions/cache@v4 | |
with: | |
path: maven-cache | |
key: ${{ runner.os }}-maven-cache-${{ hashFiles('**/pom.xml') }} | |
- name: inject go-build-cache into docker | |
uses: reproducible-containers/[email protected] | |
with: | |
cache-map: maven-cache | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
# cache-from: type=registry,ref=ipbhalle/metfragweb:buildcache | |
# cache-to: type=registry,ref=ipbhalle/metfragweb:buildcache,mode=max |