Skip to content

Commit

Permalink
[CICD] Dockerfile 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
EunbeenDev committed Jan 8, 2025
1 parent 585c98d commit 8727901
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,21 @@
FROM gradle:7.6-jdk17-alpine as builder
WORKDIR /build

# Only download dependencies if build.gradle or settings.gradle changes
# Copy Gradle settings
COPY build.gradle settings.gradle /build/
RUN gradle build -x test --parallel

# Build the application
# Debug Gradle file setup
RUN ls -l /build && cat /build/build.gradle

# Build application
COPY . /build
RUN gradle build -x test
RUN gradle build -x test --parallel --info

# Final runtime image
FROM openjdk:17.0-slim
WORKDIR /app

# Copy JAR file from builder
COPY --from=builder /build/build/libs/*-SNAPSHOT.jar ./app.jar

# Set appropriate permissions for non-root user
RUN chown nobody:nogroup /app

# Run as non-root user
USER nobody

# Expose application port
EXPOSE 8080

# Environment variables for JVM options
ENV JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom -Dsun.net.inetaddr.ttl=0"

# Application entrypoint
ENTRYPOINT ["java", "-jar", "$JAVA_OPTS", "app.jar"]
ENTRYPOINT ["java", "-jar", "/app/app.jar"]

0 comments on commit 8727901

Please sign in to comment.