-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (20 loc) · 724 Bytes
/
Dockerfile
File metadata and controls
29 lines (20 loc) · 724 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
FROM eclipse-temurin:17-jre-jammy
# Install wget for healthcheck
RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/*
# Add a non-root user to run the application
RUN groupadd -r spring && useradd -r -g spring spring
# Set working directory
WORKDIR /opt/app
# Copy the JAR file
COPY build/libs/*SNAPSHOT.jar app.jar
# Set ownership of the files
RUN chown -R spring:spring /opt/app
# Use the spring user
USER spring
# Expose the port the app runs on
EXPOSE 8080
# Configure health check - using wget instead of curl
HEALTHCHECK --interval=30s --timeout=3s \
CMD wget -q --spider http://localhost:8080/actuator/health || exit 1
# Run the application
ENTRYPOINT ["java", "-jar", "app.jar"]