Dockerfile

 1FROM node:14 AS JS_BUILD
 2WORKDIR /frontend
 3COPY ./frontend/package.json ./frontend/yarn.lock ./
 4RUN yarn install --frozen-lockfile
 5COPY ./frontend ./
 6RUN yarn build
 7
 8FROM golang:1.14 as GO_BUILD
 9WORKDIR /codies
10COPY ./go.mod ./go.sum ./
11RUN go mod download
12# Manually copying the required files to make this image's cache only include Go code.
13COPY ./main.go ./main.go
14COPY ./internal ./internal
15RUN go build .
16
17# TODO: Use distroless/static and statically compile above. (https://golang.org/issue/26492)
18FROM gcr.io/distroless/base:nonroot
19WORKDIR /codies
20COPY --from=GO_BUILD /codies/codies ./codies
21COPY --from=JS_BUILD /frontend/build ./frontend/build
22ENTRYPOINT [ "/codies/codies" ]
23EXPOSE 5000