-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (20 loc) · 783 Bytes
/
Dockerfile
File metadata and controls
33 lines (20 loc) · 783 Bytes
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
FROM gradle:8.14-jdk21 AS builder
WORKDIR /app
COPY . .
RUN chmod +x gradlew
RUN ./gradlew --no-daemon :api:capstone-api:bootJar -x test --parallel --build-cache
RUN cd api/capstone-api/build/libs && \
JAR_NAME=$(ls -1 *.jar | grep -v 'plain' | head -n 1) && \
mv "$JAR_NAME" app.jar
FROM eclipse-temurin:21-jre
ENV TZ=Asia/Seoul
RUN apt-get update && apt-get install -y tzdata && \
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /app/api/capstone-api/build/libs/app.jar /app/app.jar
RUN groupadd -r spring && useradd -r -g spring spring && \
chown -R spring:spring /app
USER spring
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/app/app.jar"]