forked from Azure-Samples/PhotoAlbum-Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (21 loc) · 639 Bytes
/
Dockerfile
File metadata and controls
31 lines (21 loc) · 639 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
# Use Maven with OpenJDK 8 for building
FROM maven:3.9.6-eclipse-temurin-8 AS build
WORKDIR /app
# Copy Maven files for dependency resolution
COPY pom.xml .
RUN mvn dependency:go-offline -B
# Copy source code
COPY src ./src
# Build the application
RUN mvn clean package -DskipTests
# Use OpenJDK 8 runtime for the final image
FROM eclipse-temurin:8-jre
WORKDIR /app
# Copy the built jar file
COPY --from=build /app/target/photo-album-*.jar app.jar
# Expose port
EXPOSE 8080
# Set JVM options for container environment
ENV JAVA_OPTS="-Xmx512m -Xms256m"
# Run the application
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar app.jar"]