diff --git a/api/Dockerfile b/api/Dockerfile index daada20e..06d6fb1b 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -1,16 +1,14 @@ # Build stage -FROM --platform=${BUILDPLATFORM} maven:3-amazoncorretto-17 as build -WORKDIR /home/lab - +FROM --platform=${BUILDPLATFORM} maven:3-amazoncorretto-20 as build +WORKDIR /usr/local/app COPY pom.xml . RUN mvn verify -DskipTests --fail-never - COPY src ./src RUN mvn verify # Run stage -FROM --platform=${TARGETPLATFORM} amazoncorretto:17 -WORKDIR /app -COPY --from=build /home/lab/target . -ENTRYPOINT ["java", "-Xmx8m", "-Xms8m", "-jar", "/app/words.jar"] +FROM --platform=${TARGETPLATFORM} amazoncorretto:20 +WORKDIR /usr/local/app +COPY --from=build /usr/local/app/target . +ENTRYPOINT ["java", "-Xmx8m", "-Xms8m", "-jar", "/usr/local/app/words.jar"] EXPOSE 8080 diff --git a/api/pom.xml b/api/pom.xml index fc91774c..46e0f650 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -80,7 +80,7 @@ com.google.guava guava - 23.0 + 32.0.1-jre org.postgresql diff --git a/web/Dockerfile b/web/Dockerfile index d08c51e8..2234802e 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -1,19 +1,21 @@ # BUILD # use the build platforms matching arch rather than target arch FROM --platform=$BUILDPLATFORM golang:alpine as builder - +WORKDIR /usr/local/app ARG TARGETARCH COPY dispatcher.go . + # build for the target arch not the build platform host arch RUN GOOS=linux GOARCH=$TARGETARCH go build dispatcher.go # RUN # defaults to using the target arch image -FROM alpine +FROM alpine:latest +WORKDIR /usr/local/app -EXPOSE 80 -CMD ["/dispatcher"] +COPY --from=builder /usr/local/app/dispatcher ./ +COPY static ./static/ -COPY --from=builder /go/dispatcher / -COPY static /static/ +EXPOSE 80 +CMD ["/usr/local/app/dispatcher"]