|
1 |
| -# Load golang image |
2 |
| -FROM golang:1.21-alpine as builder |
3 |
| - |
4 |
| -RUN apk add make |
5 |
| - |
6 |
| -ARG VERSION=undefined |
7 |
| - |
8 |
| -WORKDIR /go/src/app |
9 |
| - |
10 |
| -# Set our build environment |
11 |
| -ENV GOCACHE=/tmp/.go-build-cache |
12 |
| -# This variable communicates to the service that it's running inside |
13 |
| -# a docker container. |
14 |
| -ENV ENV_DOCKER=true |
15 |
| - |
16 |
| -# Copy dockerignore files |
17 |
| -COPY .dockerignore ./ |
18 |
| - |
19 |
| -# Install go deps using the cache |
20 |
| -COPY go.mod go.sum ./ |
21 |
| -RUN --mount=type=cache,target=/tmp/.go-build-cache \ |
22 |
| - go mod download -x |
23 |
| - |
24 |
| -COPY Makefile ./ |
25 |
| - |
26 |
| -# Copy source files |
27 |
| -COPY main.go ./ |
28 |
| -COPY cmd cmd |
29 |
| -COPY internal internal |
30 |
| - |
31 |
| -# Build it |
32 |
| -RUN --mount=type=cache,target=/tmp/.go-build-cache \ |
33 |
| - make build VERSION=$VERSION |
34 |
| - |
35 |
| -# Now create a new image with just the binary |
36 |
| -FROM gcr.io/distroless/static-debian11:nonroot |
37 |
| - |
38 |
| -WORKDIR /app |
39 |
| - |
40 |
| -COPY urns.yml /app/urns.yml |
41 |
| - |
42 |
| -# Set our runtime environment |
43 |
| -ENV ENV_DOCKER=true |
44 |
| - |
45 |
| -COPY --from=builder /go/src/app/finger /usr/local/bin/finger |
46 |
| - |
47 |
| -HEALTHCHECK CMD [ "finger", "healthcheck" ] |
48 |
| - |
49 |
| -EXPOSE 8080 |
50 |
| - |
51 |
| -ENTRYPOINT [ "finger" ] |
52 |
| -CMD [ "serve" ] |
| 1 | +# Load golang image |
| 2 | +FROM golang:1.21-alpine as builder |
| 3 | + |
| 4 | +RUN apk add make |
| 5 | + |
| 6 | +ARG VERSION=undefined |
| 7 | + |
| 8 | +WORKDIR /go/src/app |
| 9 | + |
| 10 | +# Set our build environment |
| 11 | +ENV GOCACHE=/tmp/.go-build-cache |
| 12 | +# This variable communicates to the service that it's running inside |
| 13 | +# a docker container. |
| 14 | +ENV ENV_DOCKER=true |
| 15 | + |
| 16 | +# Copy dockerignore files |
| 17 | +COPY .dockerignore ./ |
| 18 | + |
| 19 | +# Install go deps using the cache |
| 20 | +COPY go.mod go.sum ./ |
| 21 | +RUN --mount=type=cache,target=/tmp/.go-build-cache \ |
| 22 | + go mod download -x |
| 23 | + |
| 24 | +COPY Makefile ./ |
| 25 | + |
| 26 | +# Copy source files |
| 27 | +COPY main.go ./ |
| 28 | +COPY cmd cmd |
| 29 | +COPY internal internal |
| 30 | +COPY webfingers webfingers |
| 31 | +COPY handler handler |
| 32 | + |
| 33 | +# Build it |
| 34 | +RUN --mount=type=cache,target=/tmp/.go-build-cache \ |
| 35 | + make build VERSION=$VERSION |
| 36 | + |
| 37 | +# Now create a new image with just the binary |
| 38 | +FROM gcr.io/distroless/static-debian11:nonroot |
| 39 | + |
| 40 | +WORKDIR /app |
| 41 | + |
| 42 | +COPY urns.yml /app/urns.yml |
| 43 | + |
| 44 | +# Set our runtime environment |
| 45 | +ENV ENV_DOCKER=true |
| 46 | + |
| 47 | +COPY --from=builder /go/src/app/finger /usr/local/bin/finger |
| 48 | + |
| 49 | +HEALTHCHECK CMD [ "finger", "healthcheck" ] |
| 50 | + |
| 51 | +EXPOSE 8080 |
| 52 | + |
| 53 | +ENTRYPOINT [ "finger" ] |
| 54 | +CMD [ "serve" ] |
0 commit comments