-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (29 loc) · 922 Bytes
/
Dockerfile
File metadata and controls
42 lines (29 loc) · 922 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
32
33
34
35
36
37
38
39
40
41
42
# Build stage
FROM eclipse-temurin:21-jdk AS build
WORKDIR /app
# Create .gradle directory with proper permissions
RUN mkdir -p /home/app/.gradle && chmod -R 777 /home/app/.gradle
# Copy the Gradle wrapper, build.gradle and settings.gradle
COPY gradlew .
COPY gradle gradle
COPY build.gradle .
COPY settings.gradle .
# Make the gradlew script executable
RUN chmod +x ./gradlew
# Copy the source code
COPY src src
# Build the application
RUN ./gradlew build --no-daemon -x test
# Runtime stage
FROM eclipse-temurin:21-jre
WORKDIR /app
# Copy the built application from the build stage
COPY --from=build /app/build/libs/*.jar app.jar
# Environment variables for Spring Boot
ENV SPRING_DEVTOOLS_RESTART_ENABLED=false
ENV SPRING_DEVTOOLS_LIVERELOAD_ENABLED=false
ENV SPRING_DOCKER_COMPOSE_ENABLED=false
# Expose the port the app runs on
EXPOSE 8080
# Command to run the application
CMD ["java", "-jar", "app.jar"]