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
137383e6
Commit
137383e6
authored
2 months ago
by
장무현
Browse files
Options
Downloads
Patches
Plain Diff
4
parent
ee7bcf51
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
-22
23 additions, 22 deletions
.gitlab-ci.yaml
with
23 additions
and
22 deletions
.gitlab-ci.yaml
+
23
−
22
View file @
137383e6
# 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
:
stages
:
-
build
-
build
-
d
ockerize
-
d
eploy
# Step 1: Maven 빌드
cache
:
paths
:
-
.m2/repository
-
target/
# 1️⃣ 빌드 단계: Maven + JDK 17 이미지 사용
build
:
build
:
image
:
maven:3.9.6-eclipse-temurin-17
stage
:
build
stage
:
build
script
:
script
:
-
echo "✅ Maven 빌드 시작"
-
mvn clean package -DskipTests
-
mvn $MAVEN_CLI_OPTS clean package
artifacts
:
artifacts
:
paths
:
paths
:
-
target/*.jar
-
target/*.jar
-
Dockerfile
only
:
-
main
# Step 2: Docker 이미지 빌드 + Docker Hub 푸시
# 2️⃣ 배포 단계: Docker로 이미지 빌드 & DockerHub에 푸시
dockerize
:
deploy
:
stage
:
dockerize
image
:
docker:latest
image
:
docker:latest
services
:
services
:
-
docker:dind
-
docker:dind
stage
:
deploy
when
:
manual
variables
:
DOCKER_HOST
:
tcp://docker:2375
DOCKER_TLS_CERTDIR
:
"
"
before_script
:
before_script
:
-
echo "🔐 Docker Hub 로그인"
-
echo "$DOCKER_HUB_PASSWORD" | docker login -u "$DOCKER_HUB_USERID" --password-stdin
-
docker login -u "$DOCKER_HUB_USERID" -p "$DOCKER_HUB_PASSWORD"
script
:
script
:
-
echo "🐳 Docker 이미지 빌드 시작"
-
docker build -t myspringweb .
-
docker
build -t
$DOCKER_HUB_USERID/myspringweb
.
-
docker
tag myspringweb "
$DOCKER_HUB_USERID/myspringweb
"
-
docker push $DOCKER_HUB_USERID/myspringweb
-
docker push
"
$DOCKER_HUB_USERID/myspringweb
"
after_script
:
after_script
:
-
docker logout
-
docker logout
only
:
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