diff --git a/.github/workflows/docker-custom.yaml b/.github/workflows/docker-custom.yaml index 0419648eb9d..0239e181d9f 100644 --- a/.github/workflows/docker-custom.yaml +++ b/.github/workflows/docker-custom.yaml @@ -51,16 +51,27 @@ jobs: echo "IMAGE_NAME=${IMAGE_NAME}" >> $GITHUB_ENV nix build .#docker-hydra-node ./result | docker load + + VERSION_NAME=${{github.ref_name}} BRANCH_NAME="${{ github.event.inputs.branch_name }}" [[ -z "${BRANCH_NAME}" ]] && { echo "branch_name is required"; exit 1; } - + DATETIME=$(date '+%Y%m%d%H%M') - CUSTOM_TAG="hydra-node-${DATETIME}-${BRANCH_NAME}" - docker tag ${IMAGE_NAME}:unstable ${IMAGE_NAME}:${CUSTOM_TAG} - docker images - docker inspect ${IMAGE_NAME}:unstable + CUSTOM_TAG="${DATETIME}-${BRANCH_NAME}" + echo "CUSTOM_TAG=${CUSTOM_TAG}" >> $GITHUB_ENV + + # Use 'FROM' instruction to use docker build with --label + echo "FROM hydra-node" | docker build \ + --label org.opencontainers.image.source=https://github.com/cardano-scaling/hydra \ + --label org.opencontainers.image.licenses=Apache-2.0 \ + --label org.opencontainers.image.created=$(date -Is) \ + --label org.opencontainers.image.revision=${{github.sha}} \ + --label org.opencontainers.image.version=${VERSION_NAME:-unstable} \ + --tag ${IMAGE_NAME}:${CUSTOM_TAG} - + + docker inspect ${IMAGE_NAME}:${CUSTOM_TAG} - name: 📤 Push to registry run: | - docker push -a ${IMAGE_NAME} + docker push -a ${IMAGE_NAME}:${CUSTOM_TAG}