mercury/backend/Dockerfile

32 lines
697 B
Docker
Raw Normal View History

2025-01-19 13:52:31 +03:00
# Use a base image with Java 17
FROM openjdk:17-jdk-slim AS build
# Set the working directory in the container
WORKDIR /app
# Copy Gradle wrapper and configuration files
COPY gradlew .
COPY gradle/ gradle/
COPY build.gradle .
COPY settings.gradle .
# Copy the source code
COPY src/ src/
# Make Gradle wrapper executable and build the application
RUN ./gradlew build
# Use a smaller runtime image for the final build
FROM openjdk:17-jdk-slim
# Set the working directory in the container
WORKDIR /app
# Copy the built application from the build stage
COPY --from=build /app/build/libs/*.jar app.jar
# Expose port 8080
EXPOSE 8080
# Run the application
ENTRYPOINT ["java", "-jar", "app.jar"]