dockerfile: optimize and minimize layers #39
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: Developer image | |
on: # yamllint disable-line rule:truthy | |
push: | |
branches: [main] | |
paths-ignore: | |
- 'README.md' | |
- 'sample-config.conf' | |
- 'sample-config.yaml' | |
- '.github/**' | |
jobs: | |
check_versions: | |
name: Develop - Version checking | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.sogo.outputs.VERSION }} | |
steps: | |
- name: Get latest version of SOGo | |
id: sogo | |
run: | | |
echo "VERSION=$(curl -s https://api.github.com/repos/Alinto/sogo/releases/latest | jq -r '.tag_name' | sed 's/SOGo-//')" >> "$GITHUB_OUTPUT" | |
# Builds the Dockerfile and pushes it to dockerhub and GHCR | |
develop: | |
name: Develop - Docker image | |
needs: check_versions | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Docker - GHCR Login | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker - Metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/${{ github.repository }} | |
tags: type=raw,value=dev | |
flavor: latest=false | |
- name: Docker - Build / Push | |
uses: docker/build-push-action@v5 | |
with: | |
platforms: linux/amd64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
build-args: | | |
SOGO_VERSION=${{ needs.check_versions.outputs.version }} |