Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
MySpringWeb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
During summer vacation, Gitlab will be restart frequently. Use it carefully.
Show more breadcrumbs
장 무현
MySpringWeb
Commits
ee7bcf51
Commit
ee7bcf51
authored
2 months ago
by
장무현
Browse files
Options
Downloads
Patches
Plain Diff
third
parent
c62818e8
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yaml
+23
-24
23 additions, 24 deletions
.gitlab-ci.yaml
with
23 additions
and
24 deletions
.gitlab-ci.yaml
+
23
−
24
View file @
ee7bcf51
# GitLab Runner가 사용할 Docker 이미지 (Maven + JDK 포함)
image
:
maven:3.9-eclipse-temurin-17
services
:
-
docker:dind
# Docker-in-Docker 서비스 사용
variables
:
DOCKER_DRIVER
:
overlay2
MAVEN_CLI_OPTS
:
"
-B
-Dmaven.test.skip=true"
stages
:
-
build
-
deploy
cache
:
paths
:
-
.m2/repository
-
./target
-
dockerize
# Step 1: Maven 빌드
build
:
image
:
maven:3.9.6-eclipse-temurin-17
stage
:
build
script
:
-
echo "✅ Maven 빌드 시작"
-
mvn $MAVEN_CLI_OPTS clean package
artifacts
:
when
:
always
paths
:
-
./target/*.jar
-
Dockerfile
script
:
-
mvn package
-
echo "Hello, you are at build stage."
only
:
-
main
-
target/*.jar
deploy:docker
:
# Step 2: Docker 이미지 빌드 + Docker Hub 푸시
dockerize
:
stage
:
dockerize
image
:
docker:latest
services
:
-
docker:dind
stage
:
deploy
when
:
manual
variables
:
DOCKER_HOST
:
tcp://docker:2375
DOCKER_TLS_CERTDIR
:
"
"
before_script
:
-
echo "🔐 Docker Hub 로그인"
-
docker login -u "$DOCKER_HUB_USERID" -p "$DOCKER_HUB_PASSWORD"
script
:
-
docker build -t myspringweb .
-
docker
tag myspringweb "
$DOCKER_HUB_USERID/myspringweb
"
-
docker push
"
$DOCKER_HUB_USERID/myspringweb
"
-
echo "🐳 Docker 이미지 빌드 시작"
-
docker
build -t
$DOCKER_HUB_USERID/myspringweb
.
-
docker push $DOCKER_HUB_USERID/myspringweb
after_script
:
-
docker logout
only
:
...
...
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