finger/Dockerfile
Gustavo Maronato 8673f0db42
All checks were successful
Go / checks (push) Successful in 3m58s
Add missing paths to dockerfile
2024-01-25 02:38:03 -03:00

55 lines
1.1 KiB
Docker

# 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" ]