forked from Team-Catxi/Catxi_BackEnd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (26 loc) · 1.13 KB
/
Dockerfile
File metadata and controls
39 lines (26 loc) · 1.13 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
FROM eclipse-temurin:17-jdk-alpine AS build
WORKDIR /workspace/app
COPY gradlew .
COPY gradle gradle
COPY build.gradle .
COPY settings.gradle .
RUN chmod +x ./gradlew
RUN ./gradlew dependencies --no-daemon
COPY src src
RUN ./gradlew bootJar -x test --no-daemon && \
mkdir -p build/dependency && \
(cd build/dependency; jar -xf ../libs/*.jar)
FROM eclipse-temurin:17-jre-alpine
VOLUME /tmp
RUN addgroup -g 1001 -S spring && \
adduser -u 1001 -S spring -G spring
ARG DEPENDENCY=/workspace/app/build/dependency
COPY --from=build --chown=spring:spring ${DEPENDENCY}/BOOT-INF/lib /app/lib
COPY --from=build --chown=spring:spring ${DEPENDENCY}/META-INF /app/META-INF
COPY --from=build --chown=spring:spring ${DEPENDENCY}/BOOT-INF/classes /app
USER spring:spring
ENV JAVA_OPTS="-Xmx512m -Xms256m -XX:+UseSerialGC -XX:+UseContainerSupport -XX:MaxRAMPercentage=80.0"
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/actuator/health || exit 1
EXPOSE 8080
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -cp /app:/app/lib/* com.project.catxi.CatxiApplication"]