From cb79af6573b3c3b9283d11df81a4c2f2375f847e Mon Sep 17 00:00:00 2001 From: Erik Martin-Dorel Date: Tue, 16 May 2023 16:53:13 +0200 Subject: [PATCH] ci(docker): Replace `LABEL` Dockerfile commands with `labels:` (GHA) This cleanup patch sets labels in a more uniform way, and contributes to earn several (small) layers in the resulting images. Related: https://github.com/docker/build-push-action/issues/863 Close #545 --- .github/workflows/deploy-master.yml | 18 +++++++++++++++--- .github/workflows/release.yml | 18 +++++++++++++++--- Dockerfile | 10 ---------- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/.github/workflows/deploy-master.yml b/.github/workflows/deploy-master.yml index 1ea26e4e0..992cb7b99 100644 --- a/.github/workflows/deploy-master.yml +++ b/.github/workflows/deploy-master.yml @@ -39,8 +39,12 @@ jobs: push: true tags: "ocamlsf/learn-ocaml:master" labels: | + org.opencontainers.image.title=learn-ocaml + org.opencontainers.image.description=learn-ocaml app manager + org.opencontainers.image.url=https://ocaml-sf.org/ + org.opencontainers.image.vendor=The OCaml Software Foundation org.opencontainers.image.created=${{ steps.prep.outputs.created }} - org.opencontainers.image.source=${{ github.repositoryUrl }} + org.opencontainers.image.source=${{ github.server_url }}${{ github.repository }} org.opencontainers.image.version=master org.opencontainers.image.revision=${{ github.sha }} push_client: @@ -76,8 +80,12 @@ jobs: target: client tags: "ocamlsf/learn-ocaml-client:master" labels: | + org.opencontainers.image.title=learn-ocaml-client + org.opencontainers.image.description=learn-ocaml command-line client + org.opencontainers.image.url=https://ocaml-sf.org/ + org.opencontainers.image.vendor=The OCaml Software Foundation org.opencontainers.image.created=${{ steps.prep.outputs.created }} - org.opencontainers.image.source=${{ github.repositoryUrl }} + org.opencontainers.image.source=${{ github.server_url }}${{ github.repository }} org.opencontainers.image.version=master org.opencontainers.image.revision=${{ github.sha }} push_emacs_client: @@ -116,7 +124,11 @@ jobs: version=master tags: "ocamlsf/emacs-learn-ocaml-client:master" labels: | + org.opencontainers.image.title=learn-ocaml-client with emacs + org.opencontainers.image.description=learn-ocaml command-line client with emacs + org.opencontainers.image.url=https://ocaml-sf.org/ + org.opencontainers.image.vendor=The OCaml Software Foundation org.opencontainers.image.created=${{ steps.prep.outputs.created }} - org.opencontainers.image.source=${{ github.repositoryUrl }} + org.opencontainers.image.source=${{ github.server_url }}${{ github.repository }} org.opencontainers.image.version=master org.opencontainers.image.revision=${{ github.sha }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bfc6022d4..347fd449d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -160,8 +160,12 @@ jobs: ocamlsf/learn-ocaml:latest ocamlsf/learn-ocaml:${{ steps.tag.outputs.tag }} labels: | + org.opencontainers.image.title=learn-ocaml + org.opencontainers.image.description=learn-ocaml app manager + org.opencontainers.image.url=https://ocaml-sf.org/ + org.opencontainers.image.vendor=The OCaml Software Foundation org.opencontainers.image.created=${{ steps.prep.outputs.created }} - org.opencontainers.image.source=${{ github.repositoryUrl }} + org.opencontainers.image.source=${{ github.server_url }}${{ github.repository }} org.opencontainers.image.version=${{ steps.tag.outputs.tag }} org.opencontainers.image.revision=${{ github.sha }} push_client: @@ -203,8 +207,12 @@ jobs: ocamlsf/learn-ocaml-client:latest ocamlsf/learn-ocaml-client:${{ steps.tag.outputs.tag }} labels: | + org.opencontainers.image.title=learn-ocaml-client + org.opencontainers.image.description=learn-ocaml command-line client + org.opencontainers.image.url=https://ocaml-sf.org/ + org.opencontainers.image.vendor=The OCaml Software Foundation org.opencontainers.image.created=${{ steps.prep.outputs.created }} - org.opencontainers.image.source=${{ github.repositoryUrl }} + org.opencontainers.image.source=${{ github.server_url }}${{ github.repository }} org.opencontainers.image.version=${{ steps.tag.outputs.tag }} org.opencontainers.image.revision=${{ github.sha }} push_emacs_client: @@ -250,7 +258,11 @@ jobs: ocamlsf/emacs-learn-ocaml-client:latest ocamlsf/emacs-learn-ocaml-client:${{ steps.tag.outputs.tag }} labels: | + org.opencontainers.image.title=learn-ocaml-client with emacs + org.opencontainers.image.description=learn-ocaml command-line client with emacs + org.opencontainers.image.url=https://ocaml-sf.org/ + org.opencontainers.image.vendor=The OCaml Software Foundation org.opencontainers.image.created=${{ steps.prep.outputs.created }} - org.opencontainers.image.source=${{ github.repositoryUrl }} + org.opencontainers.image.source=${{ github.server_url }}${{ github.repository }} org.opencontainers.image.version=${{ steps.tag.outputs.tag }} org.opencontainers.image.revision=${{ github.sha }} diff --git a/Dockerfile b/Dockerfile index 704c1a532..4b1c13d5d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,11 +44,6 @@ COPY --from=compilation /home/opam/install-prefix/bin/learn-ocaml-client /usr/bi ENTRYPOINT ["dumb-init","/usr/bin/learn-ocaml-client"] -LABEL org.opencontainers.image.title="learn-ocaml-client" -LABEL org.opencontainers.image.description="learn-ocaml command-line client" -LABEL org.opencontainers.image.url="https://ocaml-sf.org/" -LABEL org.opencontainers.image.vendor="The OCaml Software Foundation" - FROM alpine:3.13 as program @@ -74,8 +69,3 @@ COPY --from=compilation "$opam_switch/lib/ocaml" "$opam_switch/lib/ocaml/" ENTRYPOINT ["dumb-init","/usr/bin/learn-ocaml","--sync-dir=/sync","--repo=/repository"] CMD ["build","serve"] - -LABEL org.opencontainers.image.title="learn-ocaml" -LABEL org.opencontainers.image.description="learn-ocaml app manager" -LABEL org.opencontainers.image.url="https://ocaml-sf.org/" -LABEL org.opencontainers.image.vendor="The OCaml Software Foundation"