From 653c5014c0064f41566425471d18863e929c5d11 Mon Sep 17 00:00:00 2001 From: sytone Date: Fri, 18 Mar 2022 21:37:38 -0700 Subject: [PATCH] build: update docker metadata via action --- .github/workflows/docker-publish.yml | 21 +++++++++++++++++---- Dockerfile | 4 ---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 35e3c62..ac1856c 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -23,6 +23,17 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: ghcr.io/${{ github.repository_owner }}/obsidian-remote + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 @@ -39,7 +50,9 @@ jobs: context: . #file: ./Dockerfile push: true # Will only build if this is not here - tags: ghcr.io/${{ github.repository_owner }}/obsidian-remote:latest - build-args: | - "BUILD_DATE=${{ steps.date.outputs.date }}" - "IMAGE_VERSION=${{ env.GITHUB_REF_NAME }}" + #tags: ghcr.io/${{ github.repository_owner }}/obsidian-remote:latest + # build-args: | + # "BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}" + # "IMAGE_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}" + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index 0170027..2241224 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,10 @@ FROM ghcr.io/linuxserver/baseimage-rdesktop-web:focal # set version label -ARG BUILD_DATE=unknown -ARG IMAGE_VERSION ARG OBSIDIAN_VERSION=0.13.31 LABEL org.opencontainers.image.authors="github@sytone.com" -LABEL org.opencontainers.image.created="${BUILD_DATE}" LABEL org.opencontainers.image.source="https://github.com/sytone/obsidian-remote" -LABEL org.opencontainers.image.version="${IMAGE_VERSION}" LABEL org.opencontainers.image.title="Container hosted Obsidian MD" LABEL org.opencontainers.image.description="Hosted Obsidian instance allowing access via web browser"