Marc Kupietz | dd57337 | 2024-09-08 12:16:18 +0200 | [diff] [blame] | 1 | # gitlab ci pipeline to build kustvakt docker container |
| 2 | # automatically triggered on tag pushs or run manually |
| 3 | # |
| 4 | # Download latest container from artifacts and import it: |
| 5 | # |
| 6 | # curl -Ls 'https://gitlab.ids-mannheim.de/KorAP/kustvakt/-/jobs/artifacts/master/raw/kustvakt.tar.xz?job=build-docker' | docker load |
| 7 | |
| 8 | image: docker:latest |
| 9 | |
| 10 | services: |
| 11 | - docker:dind |
| 12 | |
| 13 | build-docker: |
| 14 | rules: |
| 15 | - if: $CI_COMMIT_TAG =~ /.+/ |
| 16 | variables: |
| 17 | VID: $CI_COMMIT_TAG |
| 18 | - when: manual |
| 19 | variables: |
| 20 | VID: $CI_COMMIT_BRANCH-$CI_COMMIT_SHORT_SHA |
| 21 | stage: build |
| 22 | before_script: |
| 23 | - apk update |
| 24 | - apk add --no-cache git |
| 25 | script: |
| 26 | - docker build -f Dockerfile -t korap/kustvakt:$VID -t korap/kustvakt:latest -t korap/kustvakt:$VID-full -t korap/kustvakt:latest-full --target kustvakt-full . |
| 27 | - docker save korap/kustvakt:$VID-full | xz -T0 -M16G -9 > kustvakt.tar.xz |
| 28 | artifacts: |
| 29 | paths: |
| 30 | - kustvakt.tar.xz |
| 31 | |