Skip to content

Commit

Permalink
Added demo docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
samie committed Feb 20, 2024
1 parent 5e8dcb3 commit dc26f98
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions demo/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# First stage: JDK build
FROM openjdk:17 AS build

# Update package lists and Install Maven
RUN microdnf update -y && \
microdnf install -y maven && \
microdnf clean all

WORKDIR /usr/src/app

# Copy the Maven dependencies.
COPY pom.xml .
RUN mvn dependency:go-offline

# Copy the application source code
COPY src/ ./src/
COPY frontend/ ./frontend/

## Do the build
RUN mvn clean install -Pproduction

# Second stage: Lightweight jdk-slim image
FROM openjdk:17-jdk-slim
RUN useradd -m appuser

RUN mkdir /app && \
chown -R appuser /app

USER appuser

WORKDIR /app

# Copy the native binary from the build stage
COPY --from=build /usr/src/app/target/*.jar /app/app.jar

# Run the application
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/app/app.jar"]

0 comments on commit dc26f98

Please sign in to comment.