| Marc Kupietz | e0ca9d2 | 2025-11-30 07:49:28 +0100 | [diff] [blame] | 1 | stages: |
| 2 | - test |
| 3 | - build |
| 4 | - deploy |
| 5 | |
| 6 | test-docker-image: |
| 7 | image: docker:latest |
| 8 | stage: test |
| 9 | variables: |
| 10 | FF_NETWORK_PER_BUILD: "true" |
| 11 | services: |
| 12 | - name: docker:dind |
| 13 | alias: docker |
| 14 | command: ["--dns=127.0.0.11", "--dns=8.8.8.8"] |
| 15 | before_script: |
| 16 | - apk update |
| 17 | - apk add --no-cache bash |
| 18 | script: |
| 19 | - docker build -t korap/conllu-spacy:test . |
| 20 | - echo "Testing version display..." |
| 21 | - docker run --rm korap/conllu-spacy:test -V |
| 22 | - echo "Testing model listing..." |
| 23 | - docker run --rm korap/conllu-spacy:test -L |
| 24 | |
| 25 | build-docker-image: |
| 26 | image: docker:latest |
| 27 | stage: build |
| 28 | variables: |
| 29 | FF_NETWORK_PER_BUILD: "true" |
| 30 | services: |
| 31 | - name: docker:dind |
| 32 | alias: docker |
| 33 | command: ["--dns=127.0.0.11", "--dns=8.8.8.8"] |
| 34 | rules: |
| 35 | - if: $CI_COMMIT_TAG =~ /.+/ |
| 36 | variables: |
| 37 | VID: $CI_COMMIT_TAG |
| 38 | - when: manual |
| 39 | variables: |
| 40 | VID_ALT: $CI_COMMIT_BRANCH-$CI_COMMIT_SHORT_SHA |
| 41 | VID: snapshot |
| 42 | cache: |
| 43 | key: conllu-spacy |
| 44 | paths: |
| 45 | - cache/ |
| 46 | before_script: |
| 47 | - mkdir -p cache |
| 48 | - apk update |
| 49 | - apk add --no-cache bash make xz |
| 50 | script: |
| 51 | - make build |
| 52 | - docker tag korap/conllu-spacy:latest korap/conllu-spacy:$VID |
| 53 | - | |
| 54 | if [ -n "$VID_ALT" ]; then |
| 55 | docker tag korap/conllu-spacy:latest korap/conllu-spacy:$VID_ALT |
| 56 | fi |
| 57 | - docker save korap/conllu-spacy | xz -T0 > conllu-spacy.xz |
| 58 | artifacts: |
| 59 | paths: |
| 60 | - conllu-spacy.xz |
| 61 | |
| 62 | deploy-to-docker-hub: |
| 63 | image: docker:latest |
| 64 | stage: deploy |
| 65 | variables: |
| 66 | FF_NETWORK_PER_BUILD: "true" |
| 67 | services: |
| 68 | - name: docker:dind |
| 69 | alias: docker |
| 70 | command: ["--dns=127.0.0.11", "--dns=8.8.8.8"] |
| 71 | rules: |
| 72 | - if: $CI_COMMIT_TAG =~ /.+/ |
| 73 | - when: manual |
| 74 | dependencies: |
| 75 | - build-docker-image |
| 76 | before_script: |
| 77 | - echo "$DOCKER_HUB_PASSWORD" | docker login -u "$DOCKER_HUB_USER" --password-stdin |
| 78 | script: |
| 79 | - xz -d -c conllu-spacy.xz | docker load |
| 80 | - docker push --all-tags korap/conllu-spacy |