-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (28 loc) · 1.07 KB
/
Dockerfile
File metadata and controls
39 lines (28 loc) · 1.07 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
32
33
34
35
36
37
38
39
# Use an official Gradle image to build the application
FROM gradle:7.6.0-jdk17 AS builder
# Set the environment variable for production
ARG BUILD_ENV=prod
ENV BUILD_ENV=${BUILD_ENV}
# Set the working directory inside the container
WORKDIR /app
# Copy the Gradle wrapper and build files
COPY gradlew gradlew
COPY build.gradle build.gradle
COPY settings.gradle settings.gradle
COPY gradle gradle
# Copy the rest of the source code
COPY src src
COPY config config
COPY config/benepick/* src/main/resources/
# Run the Gradle build to create the executable JAR file
RUN ./gradlew build --no-daemon -x test -Penv=${BUILD_ENV}
# Use an official OpenJDK image as the base for the final image
FROM openjdk:17-jdk-slim
# Set the working directory inside the container
WORKDIR /app
# Copy the executable JAR file from the builder stage
COPY --from=builder /app/build/libs/*.jar benepick-backend.jar
# Expose the application port (change this if your application uses a different port)
EXPOSE 8080
# Set the entry point to run the application
ENTRYPOINT ["java", "-jar", "benepick-backend.jar"]