mirror of
https://github.com/EchoVault/SugarDB.git
synced 2025-09-26 20:11:15 +08:00
63 lines
2.2 KiB
Docker
63 lines
2.2 KiB
Docker
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/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/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}" \
|