-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
57 lines (50 loc) ยท 2.23 KB
/
Copy pathDockerfile
File metadata and controls
57 lines (50 loc) ยท 2.23 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
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", \
"-Xms512m", \
"-Xmx512m", \
"-XX:MaxMetaspaceSize=160m", \
"-XX:+UseG1GC", \
"-XX:+UseStringDeduplication", \
"-XX:MaxDirectMemorySize=64m", \
"-XX:MaxGCPauseMillis=200", \
"-XX:InitialCodeCacheSize=32m", \
"-XX:ReservedCodeCacheSize=64m", \
"-XX:+TieredCompilation", \
"-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"]