Files
SugarDB/Dockerfile.dev
Kelvin Mwinuka 93a165e9f9 Added support for HELLO command.
Load modules build from Dockerfile.dev into instances from docker-compose.yml.
Fixed user loading from config file in ACL module.
2024-07-01 06:05:07 +08:00

65 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 ./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 ./volumes/modules/module_get/module_get.go
ENV DEST=bin/linux/x86_64
RUN CGO_ENABLED=$CGO_ENABLED CC=$CC GOOS=$GOOS GOARCH=$GOARCH go build -o $DEST/server ./cmd/main.go
FROM --platform=linux/amd64 alpine:latest as server
RUN mkdir -p /usr/local/lib/echovault
RUN mkdir -p /opt/echovault/bin
RUN mkdir -p /etc/ssl/certs/echovault/echovault
RUN mkdir -p /etc/ssl/certs/echovault/client
COPY --from=build /build/volumes/modules /opt/echovault/bin/modules
COPY --from=build /build/bin/linux/x86_64/server /opt/echovault/bin
COPY ./openssl/server /etc/ssl/certs/echovault/server
COPY ./openssl/client /etc/ssl/certs/echovault/client
WORKDIR /opt/echovault/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 echovault 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}" \