You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.3 KiB

  1. ---
  2. .build:
  3. stage: build
  4. image:
  5. name: moby/buildkit:rootless
  6. entrypoint: [""]
  7. variables:
  8. BUILDKITD_FLAGS: --oci-worker-no-process-sandbox
  9. before_script:
  10. - mkdir ~/.docker
  11. - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > ~/.docker/config.json
  12. pipeline image:
  13. extends: .build
  14. script:
  15. - |
  16. buildctl-daemonless.sh build \
  17. --frontend=dockerfile.v0 \
  18. --local context=. \
  19. --local dockerfile=. \
  20. --opt filename=./pipeline.Dockerfile \
  21. --output type=image,name=$PIPELINE_IMAGE,push=true \
  22. --import-cache type=registry,ref=$CI_REGISTRY_IMAGE/pipeline:cache
  23. rules:
  24. - if: '$CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH'
  25. pipeline image and build cache:
  26. extends: .build
  27. script:
  28. - |
  29. buildctl-daemonless.sh build \
  30. --frontend=dockerfile.v0 \
  31. --local context=. \
  32. --local dockerfile=. \
  33. --opt filename=./pipeline.Dockerfile \
  34. --output type=image,name=$PIPELINE_IMAGE,push=true \
  35. --import-cache type=registry,ref=$CI_REGISTRY_IMAGE/pipeline:cache \
  36. --export-cache type=registry,ref=$CI_REGISTRY_IMAGE/pipeline:cache,mode=max
  37. rules:
  38. - if: '$CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH'