-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (37 loc) · 1.09 KB
/
Dockerfile
File metadata and controls
54 lines (37 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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
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/go-finger /usr/local/bin/go-finger
HEALTHCHECK CMD [ "go-finger", "healthcheck" ]
EXPOSE 8080
ENTRYPOINT [ "go-finger" ]
CMD [ "serve" ]