1
0
Fork 0
This repository has been archived on 2025-01-15. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
devops-with-docker/Part3/Exercise10/Dockerfile
2023-03-17 12:43:43 +02:00

16 lines
562 B
Docker

# Using the -slim images instead of alpine, because the alpine images threw error:
# library initialization failed - unable to allocate file descriptor table - out of memory
# and I didn't want to submit something that required modifying Docker settings
FROM openjdk:8-jdk-slim as build
WORKDIR /usr/src/app
COPY pom.xml ./
COPY . .
RUN ./mvnw package
FROM openjdk:8-jre-slim
EXPOSE 8080
WORKDIR /usr/src/app
COPY --from=build /usr/src/app/target/docker-example-1.1.3.jar .
RUN useradd -m appuser
USER appuser
CMD ["java", "-jar", "./docker-example-1.1.3.jar"]