Files
Potato/Dockerfile.spud
Cory Sayles 3edd9bd1ca Docker build - Just for fun (#203)
* Adding files to run in docker

* Updating build and run scripts with usage

* Updating build and run scripts to check for docker

* Fixing commented code

* Added docker compose file and added instructions
2024-08-05 09:54:32 +02:00

28 lines
716 B
Docker

########### Phase 1 - Compile ###########
FROM maven:3.9.8-eclipse-temurin-8-alpine AS potato-builder
# Set the working directory and copy src
WORKDIR /usr/src/Potato
COPY . /usr/src/Potato/
# Build with Maven
RUN mvn clean install;
########### Phase 2 - Package ###########
FROM eclipse-temurin:21
# Can be overridden with `docker run -e VEGAN="--vegan"`
ENV VEGAN=""
# Make am appropriate user name
RUN useradd -u 500 mrpotatohead
USER mrpotatohead
WORKDIR /home/mrpotatohead
# Cook this potato right every time
COPY --from=potato-builder /usr/src/Potato/target /home/mrpotatohead/target
# Allow user to pass in an argument when running the container
CMD ["sh","-c","java -jar target/Potato.jar ${VEGAN}"]