Skip to content

Latest commit

 

History

History
40 lines (32 loc) · 1020 Bytes

solution.md

File metadata and controls

40 lines (32 loc) · 1020 Bytes

Solution for SHIP IT Assignment

FROM maven:3-openjdk-11 as build
RUN mkdir /usr/src/project
COPY . /usr/src/project
WORKDIR /usr/src/project
RUN mvn package -DskipTests

FROM eclipse-temurin:11-jre
RUN mkdir /project
RUN groupadd -r brianvermeer && useradd -r -s /bin/false -g brianvermeer brianvermeer
COPY --from=build /usr/src/project/target/JavaCoffeeShop.jar /project/
RUN chown -R brianvermeer:brianvermeer /project
WORKDIR /project
USER brianvermeer
ENTRYPOINT java -jar JavaCoffeeShop.jar

or for alpine images

FROM maven:3-openjdk-11 as build
RUN mkdir /usr/src/project
COPY . /usr/src/project
WORKDIR /usr/src/project
RUN mvn package -DskipTests

FROM eclipse-temurin:11-jre-alpine
RUN mkdir /project
RUN addgroup --system brianvermeer && adduser -S -s /bin/false -G brianvermeer brianvermeer
COPY --from=build /usr/src/project/target/JavaCoffeeShop.jar /project/
RUN chown -R brianvermeer:brianvermeer /project
WORKDIR /project
USER brianvermeer
ENTRYPOINT java -jar JavaCoffeeShop.jar