Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
idatt2106-2024-07
backend
Commits
8f0050d1
Commit
8f0050d1
authored
May 2, 2024
by
Andreas
Browse files
Options
Downloads
Patches
Plain Diff
feat/Jobs for pushing docker image and deploying it
parent
2f07d186
No related branches found
No related tags found
1 merge request
!85
Feat/workflow implement docker push and deploy
Pipeline
#283442
passed with warnings
May 2, 2024
Stage: build_test
Stage: docker_build_and_push
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+33
-1
33 additions, 1 deletion
.gitlab-ci.yml
with
33 additions
and
1 deletion
.gitlab-ci.yml
+
33
−
1
View file @
8f0050d1
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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment