docker: Create a tagged image on release

This commit is contained in:
Valentin Tolmer 2021-11-29 09:41:47 +01:00 committed by nitnelave
parent 842afac7dd
commit 68013c8919
2 changed files with 24 additions and 4 deletions

View File

@ -1,11 +1,11 @@
name: ci
name: docker
on:
push:
branches:
- 'main'
tags:
- 'v*.*.*'
release:
types: [created]
pull_request:
branches:
- 'main'
@ -43,8 +43,14 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Parse the tag into semver.
- uses: gacts/github-slug@v1
id: slug
-
name: Build and push
if: github.event_name != 'release'
uses: docker/build-push-action@v2
with:
context: .
@ -53,6 +59,20 @@ jobs:
tags: nitnelave/lldap:latest
cache-from: type=gha
cache-to: type=gha,mode=max
-
name: Build and push
if: github.event_name == 'release'
uses: docker/build-push-action@v2
with:
context: .
push: true
platforms: linux/amd64
# Tag as latest, stable, semver, major, major.minor and major.minor.patch.
tags: nitnelave/lldap:latest, nitnelave/lldap:stable, nitnelave/lldap:v${{ steps.slug.outputs.version-semantic }}, nitnelave/lldap:v${{ steps.slug.outputs.version-major }}, nitnelave/lldap:v${{ steps.slug.outputs.version-major }}.${{ steps.slug.outputs.version-minor }}, nitnelave/lldap:v${{ steps.slug.outputs.version-major }}.${{ steps.slug.outputs.version-minor }}.${{ steps.slug.outputs.version-patch }}
cache-from: type=gha
cache-to: type=gha,mode=max
-
name: Update repo description
if: github.event_name != 'pull_request'

View File

@ -82,7 +82,7 @@ volumes:
services:
lldap:
image: nitnelave/lldap
image: nitnelave/lldap:stable
# Change this to the user:group you want.
user: "33:33"
ports: