-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
32 lines (23 loc) · 872 Bytes
/
Dockerfile
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
# Use an official Eclipse Temurin runtime as a parent image
FROM eclipse-temurin:17-jdk-alpine
# Set the working directory in the container
WORKDIR /app
# Create a temporary directory for building
RUN mkdir /tmpbuild
WORKDIR /tmpbuild
# Install Maven
RUN apk add --no-cache maven
# Copy only the necessary files for building the JAR
COPY pom.xml .
COPY src ./src
# Build the Java application using Maven in the temporary directory
RUN mvn clean install -Dmaven.test.skip=true
# Move the JAR file to the app directory
RUN mv target/*.jar /app/cdms.jar
# Clean up: Delete the temporary build directory and its content
WORKDIR /
RUN rm -rf /tmpbuild
# Expose the SSL port
EXPOSE 8443
# Define the command to run your application with SSL
CMD ["java", "-jar", "/app/cdms.jar", "--spring.profiles.active=docker", "--spring.main.allow-bean-definition-overriding=true"]