ModeratorElection/.gitlab-ci.yml
2024-07-18 11:25:26 +02:00

68 lines
1.5 KiB
YAML

stages:
# - test
- buildjar
- buildimage
# - publish
variables:
CACHE_FALLBACK_KEY: fallback-key
.img: &img
image: openjdk:22-jdk-slim
cache:
- key: ${CI_COMMIT_REF_SLUG}
fallback_keys:
- cache-$CI_DEFAULT_BRANCH
- cache-default
- paths:
- /var/cache/apt
- .gradle/wrapper
- .gradle/caches
before_script:
- echo "___________________START_before_script________________________"
- echo ${CI_COMMIT_REF_SLUG}
- apt-get update && apt-get -qqy upgrade
#test:
# <<: *img
# stage: test
# script:
# - ./gradlew test
buildjar:
<<: *img
stage: buildjar
script:
- ./gradlew clean build -Pvaadin.productionMode
artifacts:
name: "ModeratorElection"
paths:
- build/libs/ModeratorElection.jar
expire_in: 1 week
buildimage:
stage: buildimage
image: docker:latest
services:
- docker:dind
dependencies:
- buildjar
before_script:
- echo "---------- BEFORE -------------"
- echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY --username $CI_REGISTRY_USER --password-stdin
script:
- export DOCKER_BUILDKIT=1
- docker build --tag=moderator-election-vaadin_fullstack --target=ci-image-stage --build-arg BUILDKIT_INLINE_CACHE=1 .
artifacts:
name: "moderator-election-vaadin_fullstack"
paths:
- image/
expire_in: 1 week
# stage: image
# script:
#publish:
# stage: publish
#- export IMAGE_DOCKERHUB_USER=$DOCKERHUB_USER
#- export IMAGE_DOCKERHUB_PASSWORD=$DOCKERHUB_PASSWORD