From 8673f0db424d4f35dfa74291c0d4554c69b49813 Mon Sep 17 00:00:00 2001 From: Gustavo Maronato Date: Thu, 25 Jan 2024 02:38:03 -0300 Subject: [PATCH] Add missing paths to dockerfile --- Dockerfile | 106 +++++++++++++++++++++++++++-------------------------- 1 file changed, 54 insertions(+), 52 deletions(-) diff --git a/Dockerfile b/Dockerfile index 324806c..b4efb6a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,52 +1,54 @@ -# Load golang image -FROM golang:1.21-alpine as builder - -RUN apk add make - -ARG VERSION=undefined - -WORKDIR /go/src/app - -# Set our build environment -ENV GOCACHE=/tmp/.go-build-cache -# This variable communicates to the service that it's running inside -# a docker container. -ENV ENV_DOCKER=true - -# Copy dockerignore files -COPY .dockerignore ./ - -# Install go deps using the cache -COPY go.mod go.sum ./ -RUN --mount=type=cache,target=/tmp/.go-build-cache \ - go mod download -x - -COPY Makefile ./ - -# Copy source files -COPY main.go ./ -COPY cmd cmd -COPY internal internal - -# Build it -RUN --mount=type=cache,target=/tmp/.go-build-cache \ - make build VERSION=$VERSION - -# Now create a new image with just the binary -FROM gcr.io/distroless/static-debian11:nonroot - -WORKDIR /app - -COPY urns.yml /app/urns.yml - -# Set our runtime environment -ENV ENV_DOCKER=true - -COPY --from=builder /go/src/app/finger /usr/local/bin/finger - -HEALTHCHECK CMD [ "finger", "healthcheck" ] - -EXPOSE 8080 - -ENTRYPOINT [ "finger" ] -CMD [ "serve" ] +# Load golang image +FROM golang:1.21-alpine as builder + +RUN apk add make + +ARG VERSION=undefined + +WORKDIR /go/src/app + +# Set our build environment +ENV GOCACHE=/tmp/.go-build-cache +# This variable communicates to the service that it's running inside +# a docker container. +ENV ENV_DOCKER=true + +# Copy dockerignore files +COPY .dockerignore ./ + +# Install go deps using the cache +COPY go.mod go.sum ./ +RUN --mount=type=cache,target=/tmp/.go-build-cache \ + go mod download -x + +COPY Makefile ./ + +# Copy source files +COPY main.go ./ +COPY cmd cmd +COPY internal internal +COPY webfingers webfingers +COPY handler handler + +# Build it +RUN --mount=type=cache,target=/tmp/.go-build-cache \ + make build VERSION=$VERSION + +# Now create a new image with just the binary +FROM gcr.io/distroless/static-debian11:nonroot + +WORKDIR /app + +COPY urns.yml /app/urns.yml + +# Set our runtime environment +ENV ENV_DOCKER=true + +COPY --from=builder /go/src/app/finger /usr/local/bin/finger + +HEALTHCHECK CMD [ "finger", "healthcheck" ] + +EXPOSE 8080 + +ENTRYPOINT [ "finger" ] +CMD [ "serve" ]