init
This commit is contained in:
commit
217642cd6b
18 changed files with 877 additions and 0 deletions
29
Dockerfile
Normal file
29
Dockerfile
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# --- Stage 1: Build the JAR ---
|
||||
FROM gradle:9.2.1-jdk21 AS build
|
||||
|
||||
# Set working dir
|
||||
WORKDIR /app
|
||||
|
||||
# Copy Gradle files first (for caching)
|
||||
COPY --chown=gradle:gradle build.gradle.kts settings.gradle.kts gradle.properties gradlew ./
|
||||
COPY --chown=gradle:gradle gradle ./gradle
|
||||
|
||||
# Copy source code
|
||||
COPY --chown=gradle:gradle src ./src
|
||||
|
||||
# Build the fat jar
|
||||
RUN ./gradlew clean shadowJar --no-daemon
|
||||
|
||||
# --- Stage 2: Run the app ---
|
||||
FROM eclipse-temurin:21-jdk-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the built JAR from the build stage
|
||||
COPY --from=build /app/build/libs/*.jar app.jar
|
||||
|
||||
# Expose port (same as your server)
|
||||
EXPOSE 9000
|
||||
|
||||
# Run the app
|
||||
ENTRYPOINT ["java", "-jar", "app.jar"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue