-
Notifications
You must be signed in to change notification settings - Fork 355
/
Dockerfile
40 lines (35 loc) · 1.26 KB
/
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
31
32
33
34
35
36
37
38
39
40
# syntax=docker/dockerfile:1
ARG VERSION=dev
FROM --platform=$BUILDPLATFORM golang:1.22.6-alpine3.20 AS build
WORKDIR /build
RUN apk add --no-cache build-base ca-certificates
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg go mod download
COPY . ./
FROM build as build-lakefs
ARG VERSION TARGETOS TARGETARCH
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
GOOS=$TARGETOS GOARCH=$TARGETARCH \
go build -ldflags "-X github.com/treeverse/lakefs/pkg/version.Version=${VERSION}" -o lakefs ./cmd/lakefs
FROM build as build-lakectl
ARG VERSION TARGETOS TARGETARCH
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
GOOS=$TARGETOS GOARCH=$TARGETARCH \
go build -ldflags "-X github.com/treeverse/lakefs/pkg/version.Version=${VERSION}" -o lakectl ./cmd/lakectl
FROM alpine:3.18 AS lakectl
WORKDIR /app
ENV PATH /app:$PATH
COPY --from=build-lakectl /build/lakectl /app/
RUN apk add -U --no-cache ca-certificates
RUN addgroup -S lakefs && adduser -S lakefs -G lakefs
USER lakefs
WORKDIR /home/lakefs
ENTRYPOINT ["/app/lakectl"]
FROM lakectl AS lakefs
COPY ./scripts/wait-for /app/
COPY --from=build-lakefs /build/lakefs /app/
EXPOSE 8000/tcp
ENTRYPOINT ["/app/lakefs"]
CMD ["run"]