-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from dockersamples/small-fixes-and-updates
- Loading branch information
Showing
3 changed files
with
15 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] |