Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
billilge
stream-server
Repository navigation
Code
Issues
24
(24)
Pull requests
17
(17)
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
stream-server
/
Dockerfile
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
36 lines (28 loc) · 1.71 KB
main
Breadcrumbs
stream-server
/
Dockerfile
Copy path
Top
File metadata and controls
Code
Blame
36 lines (28 loc) · 1.71 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# syntax=docker/dockerfile:1
# ---- Build stage: Gradle wrapper로 실행 가능한 layered jar 생성 ----
FROM eclipse-temurin:21-jdk-jammy AS build
WORKDIR /workspace
# 소스 전체 복사 (build 산출물·.git·.idea 등은 .dockerignore로 제외)
COPY . .
# Gradle 캐시를 마운트해 재빌드를 빠르게 한다. bootJar는 테스트를 실행하지 않는다.
# application.jar로 이름을 고정해 extract 이후 ENTRYPOINT가 태그·버전에 흔들리지 않게 한다.
RUN --mount=type=cache,target=/root/.gradle \
chmod +x gradlew && \
./gradlew :bootstrap:bootJar --no-daemon && \
cp bootstrap/build/libs/bootstrap-*.jar application.jar && \
java -Djarmode=tools -jar application.jar extract --layers --destination extracted
# ---- Runtime stage: JRE에 레이어별로 복사 ----
FROM eclipse-temurin:21-jre-jammy AS runtime
WORKDIR /app
# 비루트 사용자로 실행
RUN groupadd --system spring && useradd --system --gid spring spring
# 변경 빈도가 낮은 레이어부터 복사해 이미지 레이어 캐시 적중률을 높인다
COPY --from=build --chown=spring:spring /workspace/extracted/dependencies/ ./
COPY --from=build --chown=spring:spring /workspace/extracted/spring-boot-loader/ ./
COPY --from=build --chown=spring:spring /workspace/extracted/snapshot-dependencies/ ./
COPY --from=build --chown=spring:spring /workspace/extracted/application/ ./
USER spring
EXPOSE 8080
# 프로파일은 이미지에 박지 않고 런타임 env(SPRING_PROFILES_ACTIVE)로 주입한다.
# JAVA_OPTS로 힙·GC 등을 넘길 수 있게 하고, exec로 java를 PID 1로 만들어 SIGTERM(graceful shutdown)을 받게 한다.
ENTRYPOINT ["sh", "-c", "exec java $JAVA_OPTS -jar application.jar"]
You can’t perform that action at this time.