forked from brave-intl/bat-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
30 lines (23 loc) · 852 Bytes
/
Dockerfile
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
FROM golang:1.22-alpine AS builder
# Put certs in builder image.
RUN apk update
RUN apk add -U --no-cache ca-certificates && update-ca-certificates
RUN apk add make build-base git bash
ARG VERSION
ARG BUILD_TIME
ARG COMMIT
WORKDIR /src
COPY . ./
RUN --mount=type=cache,target=/go/pkg/mod \
cd main && go mod download && CGO_ENABLED=0 GOOS=linux GOTOOLCHAIN=local go build \
-ldflags "-w -s -X main.version=${VERSION} -X main.buildTime=${BUILD_TIME} -X main.commit=${COMMIT}" \
-o bat-go main.go
FROM alpine:3.19 AS base
# Put certs in artifact from builder.
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /src/main/bat-go /bin/
FROM base AS artifact
COPY --from=builder /src/migrations/ /migrations/
USER nobody
EXPOSE 3333
CMD ["bat-go", "serve", "grant", "--enable-job-workers", "true"]