Skip to content
Snippets Groups Projects
Commit 8f0050d1 authored by Andreas's avatar Andreas
Browse files

feat/Jobs for pushing docker image and deploying it

parent 2f07d186
No related branches found
No related tags found
1 merge request!85Feat/workflow implement docker push and deploy
Pipeline #283442 passed with warnings
image: maven:3.8.5-openjdk-17 image: maven:3.8.5-openjdk-17
variables: variables:
MAVEN_CLI_OPTS: "-s ci_settings.xml --batch-mode"
DOCKER_IMAGE: "testimage"
DOCKER_TLS_CERTDIR: ""
DOCKER_HOST: "tcp://docker:2375"
SPRING_PROFILES_ACTIVE: gitlab-ci SPRING_PROFILES_ACTIVE: gitlab-ci
cache: cache:
...@@ -13,6 +17,8 @@ stages: ...@@ -13,6 +17,8 @@ stages:
- generate_site_reports - generate_site_reports
- modify_generated_site_reports - modify_generated_site_reports
- pages - pages
- docker_build_and_push
- deploy
build_test_project: build_test_project:
stage: build_test stage: build_test
...@@ -76,3 +82,29 @@ pages: ...@@ -76,3 +82,29 @@ pages:
- public - public
only: only:
- master - master
docker_build_and_push:
stage: docker_build_and_push
image: docker:latest
services:
- docker:dind
tags:
- dind
script:
- docker login -u henrikberg -p glpat-YvYeLgDcN_NgquinYKGH registry.gitlab.com
- docker build -t registry.gitlab.com/henrikberg/sparesti-registry:backend .
- docker push registry.gitlab.com/henrikberg/sparesti-registry:backend
when: manual
deploy_docker:
stage: deploy
image: ubuntu:latest
before_script:
- apt-get -yq update
- apt-get -yqq install ssh
- apt-get install sshpass
script:
- sshpass -p sParest1en ssh -v -o StrictHostKeyChecking=no root@128.199.53.153 "docker ps -q --filter 'name=^backend$' | grep -q . && docker kill backend && docker rm backend; docker run -d --name backend registry.gitlab.com/henrikberg/sparesti-registry:backend"
when: manual
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment