gitlab-notification/.gitlab-ci.yml

57 lines
1.5 KiB
YAML
Raw Normal View History

2022-01-26 10:56:18 +03:00
stages:
- build
- deploy
2022-01-26 12:56:43 +03:00
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
2022-01-26 10:56:18 +03:00
build:
2022-01-26 12:41:36 +03:00
image: maven:3.8.4-openjdk-17
2022-01-26 10:56:18 +03:00
stage: build
2022-01-26 12:41:36 +03:00
variables:
MAVEN_OPTS: "-Dmaven.repo.local=./.m2/repository"
2022-01-26 10:56:18 +03:00
only:
2022-01-26 12:41:36 +03:00
- test
# except:
# - branches
2022-01-26 10:56:18 +03:00
script:
- 'mvn -U clean package'
artifacts:
paths:
- gitlab-app/target/gitlab-notification.jar
2022-01-26 12:41:36 +03:00
docker-build:
2022-01-26 17:39:04 +03:00
image: upagge/docker-buildx:latest
2022-01-26 10:56:18 +03:00
stage: deploy
only:
2022-01-26 12:41:36 +03:00
- test
# except:
# - branches
2022-01-26 10:56:18 +03:00
services:
- docker:dind
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY --username $CI_REGISTRY_USER --password-stdin
script:
2022-01-26 10:59:40 +03:00
- cd gitlab-app
2022-01-26 12:41:36 +03:00
- docker buildx create --use
2022-01-26 12:43:02 +03:00
- docker buildx build --push --no-cache --platform linux/arm/v7,linux/arm64/v8,linux/amd64 -f Dockerfile-linux -t "upagge/test:latest" .
2022-01-26 12:41:36 +03:00
# - docker push "$CI_REGISTRY_IMAGE:latest"
# - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG"
#docker-build-master:
# image: docker/buildx-bin
# stage: deploy
# only:
# - /^v.*$/
# except:
# - branches
# services:
# - docker:dind
# before_script:
# - echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY --username $CI_REGISTRY_USER --password-stdin
# script:
# - cd gitlab-app
# - docker build --no-cache -f Dockerfile-linux -t "$CI_REGISTRY_IMAGE:latest" . -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG"
# - docker push "$CI_REGISTRY_IMAGE:latest"
# - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG"