Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dockerfiles (versions) and update guava to resolve CVEs #46

Merged
merged 1 commit into from
Sep 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions api/Dockerfile
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
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.0</version>
<version>32.0.1-jre</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
Expand Down
14 changes: 8 additions & 6 deletions web/Dockerfile
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"]