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
Show more breadcrumbs
junseo lee
MySpringWeb
Commits
7da57d92
Commit
7da57d92
authored
1 year ago
by
junseo lee
Browse files
Options
Downloads
Patches
Plain Diff
[Modify] maven project build
parent
273e4bc2
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
Dockerfile
+20
-4
20 additions, 4 deletions
Dockerfile
with
20 additions
and
4 deletions
Dockerfile
+
20
−
4
View file @
7da57d92
# Base image: OpenJDK 17
# Base image: OpenJDK 17 with Maven
FROM
maven:3.8.4-openjdk-17-slim
AS
build
# 작업 디렉토리 설정
WORKDIR
/app
# 소스 코드 복사
COPY
pom.xml .
COPY
src ./src
# Maven을 사용하여 프로젝트 빌드
RUN
mvn clean package
# 빌드가 완료된 JAR 파일을 target 폴더로 이동
RUN
mv
target/myspringweb-0.0.1-SNAPSHOT.jar /app/target/app.jar
# 실제 실행할 이미지 생성
FROM
openjdk:17
#
앱을 실행시키기 위한 폴더 생성
#
작업 디렉토리 설정
WORKDIR
/app
#
호스트의 'target' 폴더에 있는 JAR 파일을 컨테이너의 '/app' 폴더
로 복사
COPY
target/myspringweb-0.0.1-SNAPSHOT.jar app.jar
#
빌드된 JAR 파일을 이미지
로 복사
COPY
--from=build /app/target/app.jar .
# 컨테이너의 8098 포트를 호스트의 8098 포트와 연결
EXPOSE
8098
...
...
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