-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathDockerfile.dev
62 lines (50 loc) · 2.16 KB
/
Dockerfile.dev
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
57
58
59
60
61
62
FROM --platform=linux/amd64 golang:alpine AS build
RUN apk add --no-cache gcc musl-dev
WORKDIR /build
COPY . ./
ENV CGO_ENABLED=1 CC=gcc GOOS=linux GOARCH=amd64
ENV DEST=volumes/modules
RUN CGO_ENABLED=$CGO_ENABLED CC=$CC GOOS=$GOOS GOARCH=$GOARCH go build -buildmode=plugin -o $DEST/module_set/module_set.so ./internal/volumes/modules/go/module_set/module_set.go
RUN CGO_ENABLED=$CGO_ENABLED CC=$CC GOOS=$GOOS GOARCH=$GOARCH go build -buildmode=plugin -o $DEST/module_get/module_get.so ./internal/volumes/modules/go/module_get/module_get.go
ENV DEST=bin
RUN CGO_ENABLED=$CGO_ENABLED CC=$CC GOOS=$GOOS GOARCH=$GOARCH go build -o $DEST/server ./cmd/...
FROM --platform=linux/amd64 alpine:latest AS server
RUN mkdir -p /usr/sugardb/bin/modules
RUN mkdir -p /etc/ssl/certs/sugardb/server
RUN mkdir -p /etc/ssl/certs/sugardb/client
COPY --from=build /build/volumes/modules /usr/sugardb/bin/modules
COPY --from=build /build/bin/server /usr/sugardb/bin
COPY ./openssl/server /etc/ssl/certs/sugardb/server
COPY ./openssl/client /etc/ssl/certs/sugardb/client
WORKDIR /usr/sugardb/bin
CMD "./server" \
"--bind-addr" "${BIND_ADDR}" \
"--port" "${PORT}" \
"--discovery-port" "${DISCOVERY_PORT}" \
"--server-id" "${SERVER_ID}" \
"--join-addr" "${JOIN_ADDR}" \
"--data-dir" "${DATA_DIR}" \
"--snapshot-threshold" "${SNAPSHOT_THRESHOLD}" \
"--snapshot-interval" "${SNAPSHOT_INTERVAL}" \
"--max-memory" "${MAX_MEMORY}" \
"--eviction-policy" "${EVICTION_POLICY}" \
"--eviction-sample" "${EVICTION_SAMPLE}" \
"--eviction-interval" "${EVICTION_INTERVAL}" \
"--tls=${TLS}" \
"--mtls=${MTLS}" \
"--bootstrap-cluster=${BOOTSTRAP_CLUSTER}" \
"--acl-config=${ACL_CONFIG}" \
"--require-pass=${REQUIRE_PASS}" \
"--password=${PASSWORD}" \
"--forward-commands=${FORWARD_COMMAND}" \
"--restore-snapshot=${RESTORE_SNAPSHOT}" \
"--restore-aof=${RESTORE_AOF}" \
"--aof-sync-strategy=${AOF_SYNC_STRATEGY}" \
# List of sugardb cert/key pairs
"--cert-key-pair=${CERT_KEY_PAIR_1}" \
"--cert-key-pair=${CERT_KEY_PAIR_2}" \
# List of client certs
"--client-ca=${CLIENT_CA_1}" \
# List of plugins to load on startup
"--loadmodule=${MODULE_1}" \
"--loadmodule=${MODULE_2}" \