forked from baetyl/baetyl-cloud
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
19 lines (18 loc) · 709 Bytes
/
Dockerfile
File metadata and controls
19 lines (18 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:alpine AS builder
ARG GOPROXY
ARG GIT_REV
ARG VERSION
ARG TARGETARCH
ARG TARGETOS
COPY / /go/src/baetyl-cloud
WORKDIR /go/src/baetyl-cloud
ENV GOPROXY=${GOPROXY:-direct}
RUN --mount=type=cache,id=gomod,target=/go/pkg/mod \
go mod download -x
RUN --mount=type=cache,id=gomod,target=/go/pkg/mod \
GOARCH=${TARGETARCH} CGO_ENABLED=0 \
go build -ldflags "-s -w -X github.com/baetyl/baetyl-go/v2/utils.REVISION=${GIT_REV} -X github.com/baetyl/baetyl-go/v2/utils.VERSION=${VERSION}" .
FROM scratch
COPY /scripts/native/templates /etc/templates
COPY --from=builder /go/src/baetyl-cloud/baetyl-cloud /bin/baetyl-cloud
ENTRYPOINT ["/bin/baetyl-cloud"]