Skip to content

Commit

Permalink
dockerfile run app as spring user
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisvang committed Feb 18, 2025
1 parent dd794dd commit b0bf816
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# syntax=docker/dockerfile:1

################################################################################
# BUILD STAGE
# BUILD JAR

FROM maven:3-eclipse-temurin-21-alpine AS builder

Expand All @@ -37,10 +37,15 @@ ADD . /builder
RUN mvn --quiet --batch-mode --update-snapshots --fail-fast -DskipTests package

################################################################################
# RUN STAGE
# BUILD IMAGE

FROM eclipse-temurin:21-jdk-alpine

# add non-root user to run the app
# https://spring.io/guides/gs/spring-boot-docker
RUN addgroup -S spring && adduser -S spring -G spring
USER spring:spring

WORKDIR /fdp

COPY --from=builder /builder/target/fdp-spring-boot.jar /fdp/app.jar
Expand Down

0 comments on commit b0bf816

Please sign in to comment.