Commit dbbd0188 authored by Carsten Heidmann's avatar Carsten Heidmann
Browse files

Merge branch 'pr-gitlab-ci' into 'master'

Add GitLab CI Configuration

See merge request hifis-technical-platform/helmholtz-marketplace-server!2
parents 1b4fba87 3458b488
Pipeline #32215 passed with stages
in 4 minutes and 55 seconds
name: Docker
on:
push:
branches: [ master ]
release:
types: [published]
jobs:
docker_build:
name: Create and push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Push to Docker Hub
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: helmholtzcloud/marketplace
tag_with_ref: true
tags: latest
stages:
- build
- test
- pre_package
- package
- deploy
variables:
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
DOCKER_IMAGE_TAGGED: helmholtzcloud/marketplace:$CI_COMMIT_SHA
DOCKER_IMAGE_LATEST: helmholtzcloud/marketplace:latest
cache:
key: "$CI_COMMIT_REF_NAME"
paths:
- ".m2/repository"
include:
- local: .gitlab/ci/create-docker-image-ci.yml
\ No newline at end of file
maven_build:
only:
- master
- tags
- merge_requests
stage: pre_package
# dependencies:
# - ci_build
image: maven:3-jdk-11
script: "mvn install"
artifacts:
paths:
- "target/*.jar"
expire_in: 600 seconds
tags:
- "docker"
docker_push:
only:
- master
stage: package
image: docker:19.03.11
services:
- name: docker:19.03.11-dind
alias: docker
before_script:
- docker info
script:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- docker build -t $DOCKER_IMAGE_LATEST .
# - docker build -t $DOCKER_IMAGE_TAGGED .
# - docker push $DOCKER_IMAGE_TAGGED
# - docker tag $DOCKER_IMAGE_TAGGED $DOCKER_IMAGE_LATEST
- docker push $DOCKER_IMAGE_LATEST
dependencies:
- maven_build
tags:
- "docker"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment