-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (22 loc) · 817 Bytes
/
Dockerfile
File metadata and controls
29 lines (22 loc) · 817 Bytes
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
# syntax=docker/dockerfile:1
FROM golang:1.26-alpine AS builder
RUN apk update && apk add --no-cache \
protoc \
make gcc musl-dev
# install protoc requirements based on https://grpc.io/docs/languages/go/quickstart/
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.36.10
RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5.1
ENV PATH="$PATH:$(go env GOPATH)/bin"
WORKDIR /app
# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change
COPY go.mod ./
COPY go.sum ./
RUN go mod download && go mod verify
COPY . ./
RUN make deps
RUN make build
FROM dhi.io/golang:1-alpine3.23-dev
WORKDIR /
COPY --from=builder /app/build/api-server /api-server
COPY --from=builder /app/.env_template /.env
ENTRYPOINT ["/api-server"]