-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (25 loc) · 803 Bytes
/
Dockerfile
File metadata and controls
33 lines (25 loc) · 803 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
# Stage 1: Build Stage
FROM eclipse-temurin:21.0.1_12-jdk-alpine AS build
WORKDIR /app
# Install Maven
RUN apk update && \
apk add --no-cache maven
# Copy the Maven POM file to the container
COPY pom.xml .
# Download the dependencies and build the JAR file
RUN mvn dependency:go-offline
COPY src src
RUN mvn package -DskipTests
# Stage 2: Runtime Stage
FROM eclipse-temurin:21.0.1_12-jre-alpine
WORKDIR /app
# Install Curl
RUN apk update && \
apk add --no-cache curl
# Copy only the JAR file from the build stage
COPY --from=build /app/target/demo-0.0.1-SNAPSHOT.jar .
# Copy script for later end-to-end tests
COPY ./e2e/app-test.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/app-test.sh
# Specify the command to run on container startup
CMD ["java", "-jar", "demo-0.0.1-SNAPSHOT.jar"]