Add missing paths to dockerfile

This commit is contained in:
Gustavo Maronato 2024-01-25 02:38:03 -03:00
parent de3da93523
commit 8673f0db42

View file

@ -1,52 +1,54 @@
# Load golang image # Load golang image
FROM golang:1.21-alpine as builder FROM golang:1.21-alpine as builder
RUN apk add make RUN apk add make
ARG VERSION=undefined ARG VERSION=undefined
WORKDIR /go/src/app WORKDIR /go/src/app
# Set our build environment # Set our build environment
ENV GOCACHE=/tmp/.go-build-cache ENV GOCACHE=/tmp/.go-build-cache
# This variable communicates to the service that it's running inside # This variable communicates to the service that it's running inside
# a docker container. # a docker container.
ENV ENV_DOCKER=true ENV ENV_DOCKER=true
# Copy dockerignore files # Copy dockerignore files
COPY .dockerignore ./ COPY .dockerignore ./
# Install go deps using the cache # Install go deps using the cache
COPY go.mod go.sum ./ COPY go.mod go.sum ./
RUN --mount=type=cache,target=/tmp/.go-build-cache \ RUN --mount=type=cache,target=/tmp/.go-build-cache \
go mod download -x go mod download -x
COPY Makefile ./ COPY Makefile ./
# Copy source files # Copy source files
COPY main.go ./ COPY main.go ./
COPY cmd cmd COPY cmd cmd
COPY internal internal COPY internal internal
COPY webfingers webfingers
# Build it COPY handler handler
RUN --mount=type=cache,target=/tmp/.go-build-cache \
make build VERSION=$VERSION # Build it
RUN --mount=type=cache,target=/tmp/.go-build-cache \
# Now create a new image with just the binary make build VERSION=$VERSION
FROM gcr.io/distroless/static-debian11:nonroot
# Now create a new image with just the binary
WORKDIR /app FROM gcr.io/distroless/static-debian11:nonroot
COPY urns.yml /app/urns.yml WORKDIR /app
# Set our runtime environment COPY urns.yml /app/urns.yml
ENV ENV_DOCKER=true
# Set our runtime environment
COPY --from=builder /go/src/app/finger /usr/local/bin/finger ENV ENV_DOCKER=true
HEALTHCHECK CMD [ "finger", "healthcheck" ] COPY --from=builder /go/src/app/finger /usr/local/bin/finger
EXPOSE 8080 HEALTHCHECK CMD [ "finger", "healthcheck" ]
ENTRYPOINT [ "finger" ] EXPOSE 8080
CMD [ "serve" ]
ENTRYPOINT [ "finger" ]
CMD [ "serve" ]