ModeratorElection/.gitlab-ci.yml

69 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
# cache:
# - key: ${CI_COMMIT_REF_SLUG}
# script:
# - ./gradlew clean build -Pvaadin.productionMode
# artifacts:
# name: "ModeratorElection"
# paths:
# - build/libs/
# expire_in: 1 week
buildimage:
stage: buildimage
image: docker:latest
services:
- docker:dind
cache:
- key: ${CI_COMMIT_REF_SLUG}
# 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=latest --target=ci-image-stage --build-arg BUILDKIT_INLINE_CACHE=1 .
- docker push $CI_REGISTRY_USER/moderator-election-vaadin_fullstack
# stage: image
# script:
#publish:
# stage: publish
#- export IMAGE_DOCKERHUB_USER=$DOCKERHUB_USER
#- export IMAGE_DOCKERHUB_PASSWORD=$DOCKERHUB_PASSWORD