-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (24 loc) · 1.04 KB
/
Dockerfile
File metadata and controls
31 lines (24 loc) · 1.04 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
# Stage 1: Build the application using a Gradle image
FROM gradle:8.4-jdk17-alpine AS build
WORKDIR /home/gradle/src
# Copy only the necessary files to leverage Docker layer caching
COPY build.gradle.kts settings.gradle.kts gradle.properties ./
COPY gradlew ./
COPY gradle ./gradle
# Make the Gradle wrapper executable
RUN chmod +x ./gradlew # <-- ADDED THIS LINE to ensure permissions are correct
# Copy the source code of all modules
COPY common ./common
COPY server ./server
COPY serverAndAdminCommon ./serverAndAdminCommon
# Build the server application and create a runnable distribution
# The --no-daemon flag is recommended for CI/CD environments
RUN ./gradlew :server:installDist --no-daemon
# Stage 2: Create the final, lightweight runtime image
FROM amazoncorretto:17-alpine-jdk
WORKDIR /app
# Copy the built application from the 'build' stage
COPY --from=build /home/gradle/src/server/build/install/server .
# The 'installDist' task creates a startup script in the 'bin' directory.
# This command will start the server.
ENTRYPOINT ["./bin/server"]