refactor: move OCI image.source LABEL out of Dockerfile

Defining the LABEL via an ARG at the top of the Dockerfile prevents other GitHub repositories (or local Docker users) from leveraging otherwise identical cache layers.

PR: #18
This commit is contained in:
innovaker 2021-05-09 20:50:17 +01:00
parent 4f80f973e6
commit 7f4cdc99ef
2 changed files with 2 additions and 4 deletions

View File

@ -83,7 +83,8 @@ jobs:
ZEPHYR_VERSION=${{ env.zephyr-version }} ZEPHYR_VERSION=${{ env.zephyr-version }}
ARCHITECTURE=${{ matrix.architecture }} ARCHITECTURE=${{ matrix.architecture }}
ZEPHYR_SDK_VERSION=${{ env.zephyr-sdk-version }} ZEPHYR_SDK_VERSION=${{ env.zephyr-sdk-version }}
REPOSITORY_URL=${{ github.server_url }}/${{ github.repository }} labels: |
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
tags: | tags: |
docker.io/${{ secrets.DOCKER_HUB_NAMESPACE }}/${{ steps.vars.outputs.candidate-tag }} docker.io/${{ secrets.DOCKER_HUB_NAMESPACE }}/${{ steps.vars.outputs.candidate-tag }}
cache-from: type=registry,ref=docker.io/${{ secrets.DOCKER_HUB_NAMESPACE }}/${{ steps.vars.outputs.cache-from }},push=false cache-from: type=registry,ref=docker.io/${{ secrets.DOCKER_HUB_NAMESPACE }}/${{ steps.vars.outputs.cache-from }},push=false

View File

@ -4,9 +4,6 @@ CMD ["/bin/bash"]
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
ARG REPOSITORY_URL=https://github.com/innovaker/zmk-docker
LABEL org.opencontainers.image.source ${REPOSITORY_URL}
ARG ZEPHYR_VERSION ARG ZEPHYR_VERSION
ENV ZEPHYR_VERSION=${ZEPHYR_VERSION} ENV ZEPHYR_VERSION=${ZEPHYR_VERSION}
RUN \ RUN \