forked from ImFineThxAndYou/server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (24 loc) · 761 Bytes
/
Copy pathDockerfile
File metadata and controls
31 lines (24 loc) · 761 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
# Stage 1: Build with Gradle Wrapper
FROM openjdk:17-jdk-slim AS build
WORKDIR /app
# Copy gradle wrapper and build files
COPY gradlew .
COPY gradle ./gradle
COPY build.gradle .
COPY settings.gradle .
# Make gradlew executable
RUN chmod +x ./gradlew
# Copy source code
COPY src ./src
# Build the application, skipping tests
RUN ./gradlew build --no-daemon -x test
# Stage 2: Create the final image
FROM openjdk:17-jdk-slim
WORKDIR /app
# install curl for health check
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
# Copy the built jar from the build stage
COPY --from=build /app/build/libs/*.jar app.jar
# Expose port and run the application
EXPOSE 8080
ENTRYPOINT ["java","-jar","/app/app.jar","--server.address=0.0.0.0"]