This commit is contained in:
bacon
2024-03-21 10:32:53 +03:00
parent 581d9d4c84
commit fa08480a34

View File

@@ -80,24 +80,24 @@ Build:
services:
- docker:25.0.5-dind
before_script:
- echo "$CI_CONTAINER_REGISTRY"
- echo "$CI_REGISTRY"
# - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_CONTAINER_REGISTRY
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
# fetches the latest image (not failing if image is not found)
# - docker pull $CI_REGISTRY_IMAGE:latest || true
- docker pull $CI_REGISTRY_IMAGE:latest || true
# builds the project, passing proxy variables, using OCI labels
# notice the cache-from, which is going to use the image we just pulled locally
# the built image is tagged locally with the commit SHA, and then pushed to
# the GitLab registry
- docker build \
--label "org.opencontainers.image.title=$CI_PROJECT_TITLE" \
--label "org.opencontainers.image.url=$CI_PROJECT_URL" \
--label "org.opencontainers.image.created=$CI_JOB_STARTED_AT" \
--label "org.opencontainers.image.revision=$CI_COMMIT_SHA" \
--label "org.opencontainers.image.version=$CI_COMMIT_REF_NAME" \
--tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA \
- >
docker build
--pull
--label "org.opencontainers.image.title=$CI_PROJECT_TITLE"
--label "org.opencontainers.image.url=$CI_PROJECT_URL"
--label "org.opencontainers.image.created=$CI_JOB_STARTED_AT"
--label "org.opencontainers.image.revision=$CI_COMMIT_SHA"
--label "org.opencontainers.image.version=$CI_COMMIT_REF_NAME"
--tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
.
# - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA