2021-11-02 16:44:51 +02:00
|
|
|
# FROM golang:1.17-alpine AS cache
|
2021-11-03 13:51:41 +02:00
|
|
|
# AWS CodeBuild fails due to Docker's pull rate limit, using ECR.
|
2021-11-02 16:44:51 +02:00
|
|
|
FROM public.ecr.aws/bitnami/golang:1.17 AS cache
|
2021-10-10 18:49:39 +03:00
|
|
|
WORKDIR /go/src/app
|
2021-11-02 16:55:29 +02:00
|
|
|
COPY go.* ./
|
2021-10-10 18:49:39 +03:00
|
|
|
COPY internal ./internal
|
|
|
|
RUN go mod download
|
2021-11-02 16:55:29 +02:00
|
|
|
COPY cmd/cache ./
|
2021-10-10 18:49:39 +03:00
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags '-s' -o cache .
|
|
|
|
|
|
|
|
FROM scratch
|
|
|
|
COPY --from=cache /go/src/app/cache /cache
|
|
|
|
CMD ["/cache"]
|