forked from weaviate/weaviate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (48 loc) · 2.14 KB
/
Dockerfile
File metadata and controls
56 lines (48 loc) · 2.14 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# syntax=docker/dockerfile:1.6
# Dockerfile for development purposes.
# Read docs/development.md for more information
# vi: ft=dockerfile
###############################################################################
# Base build image
FROM golang:1.25-alpine AS build_base
ENV GO111MODULE=on
RUN apk add --no-cache bash ca-certificates git gcc g++ libc-dev
WORKDIR /go/src/github.com/weaviate/weaviate
COPY go.mod go.sum ./
RUN go mod download
###############################################################################
# This image builds the weaviate server
FROM build_base AS server_builder
RUN mkdir -p /runtime/go-ego
ARG TARGETARCH
ARG GIT_BRANCH="unknown"
ARG GIT_REVISION="unknown"
ARG BUILD_USER="unknown"
ARG BUILD_DATE="unknown"
ARG EXTRA_BUILD_ARGS=""
ARG CGO_ENABLED=1
ENV CGO_ENABLED=$CGO_ENABLED
COPY . .
RUN GOOS=linux GOARCH=${TARGETARCH} \
go build $EXTRA_BUILD_ARGS -trimpath \
-ldflags="-s -w -extldflags '-static' \
-X github.com/weaviate/weaviate/usecases/build.Branch=${GIT_BRANCH} \
-X github.com/weaviate/weaviate/usecases/build.Revision=${GIT_REVISION} \
-X github.com/weaviate/weaviate/usecases/build.BuildUser=${BUILD_USER} \
-X github.com/weaviate/weaviate/usecases/build.BuildDate=${BUILD_DATE}" \
-o /weaviate-server ./cmd/weaviate-server
RUN go_ego_dir=/go/pkg/mod/github.com/go-ego && \
if [ -d "$go_ego_dir" ]; then cp -a "$go_ego_dir/." /runtime/go-ego/; fi
###############################################################################
# This creates an image that can be used to fake an api for telemetry acceptance test purposes
FROM build_base AS telemetry_mock_api
COPY . .
ENTRYPOINT ["./tools/dev/telemetry_mock_api.sh"]
###############################################################################
# Weaviate (no differentiation between dev/test/prod - 12 factor!)
FROM alpine:3.22 AS weaviate
RUN apk add --no-cache bc ca-certificates openssl && mkdir ./modules
COPY --from=server_builder /weaviate-server /bin/weaviate
COPY --from=server_builder /runtime/go-ego/ /go/pkg/mod/github.com/go-ego/
ENTRYPOINT ["/bin/weaviate"]
CMD ["--host","0.0.0.0","--port","8080","--scheme","http"]