-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
59 lines (52 loc) · 2.27 KB
/
Dockerfile
File metadata and controls
59 lines (52 loc) · 2.27 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
FROM ubuntu:22.04 as tools
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
coreutils && \
rm -rf /var/lib/apt/lists/*
# JRE만 있는 가벼운 이미지 사용
FROM eclipse-temurin:17-jre-jammy
WORKDIR /app
COPY --from=tools /usr/bin/base64 /usr/bin/base64
COPY --from=tools /bin/tar /bin/tar
COPY app/*.jar ./app.jar
# =========================================================================
# 1. 폴더 Secret 처리 (Base64 -> tar.gz -> 폴더 복원)
# =========================================================================
# 'wallet_base64' id로 secret을 마운트합니다.
RUN --mount=type=secret,id=wallet_base64 \
# Secret 파일의 내용을 읽어 base64 디코딩 후, tar로 압축을 해제합니다.
# 결과물은 /app/src/main/resources/main-wallet 경로에 생성됩니다.
mkdir -p /app/src/main/resources && \
cat /run/secrets/wallet_base64 | base64 -d | tar -xz -C /app/src/main/resources
# =========================================================================
# 2. 파일 Secret 처리 (Base43 -> JSON 내용 -> 파일 생성)
# =========================================================================
# id로 secret을 마운트합니다.
RUN --mount=type=secret,id=firebase_base64 \
# 먼저 디렉토리를 생성하고 파일을 생성합니다. \
# Secret 파일 내용을 /app/src/main/resources/pray-together-firebase-adminsdk.json 파일에 씁니다.
cat /run/secrets/firebase_base64 | base64 -d > /app/src/main/resources/pray-together-firebase-adminsdk.json
# Heap dump 저장 디렉토리 생성
RUN mkdir -p /app/logs
ENV SPRING_PROFILES_ACTIVE=prod
ENTRYPOINT ["java", \
"-Xms256m", \
"-Xmx512m", \
"-Xss1m", \
"-XX:MaxMetaspaceSize=160m", \
"-XX:+UseG1GC", \
"-XX:+UseStringDeduplication", \
"-XX:MaxDirectMemorySize=64m", \
"-XX:MaxGCPauseMillis=200", \
"-XX:InitialCodeCacheSize=32m", \
"-XX:ReservedCodeCacheSize=64m", \
"-XX:+TieredCompilation", \
"-XX:TieredStopAtLevel=1", \
"-Xlog:gc*:file=/app/logs/gc-%t.log:time,level,tags", \
"-XX:+HeapDumpOnOutOfMemoryError", \
"-XX:HeapDumpPath=/app/logs/heapdump-%t-%p.hprof", \
"-XX:ErrorFile=/app/logs/hs_err_pid%p.log", \
"-XX:+ExitOnOutOfMemoryError", \
"-Djava.security.egd=file:/dev/./urandom", \
"-jar", \
"app.jar"]