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
This commit is contained in:
Cory Sayles
2024-08-05 03:54:32 -04:00
committed by GitHub
parent 586205e678
commit 3edd9bd1ca
6 changed files with 131 additions and 0 deletions

27
Dockerfile.spud Normal file
View File

@@ -0,0 +1,27 @@
########### 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}"]