Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating Dockerfile.dev to use multi stage build for creating binarys #52

Merged
merged 3 commits into from
Jun 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
FROM --platform=linux/amd64 alpine:latest
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 ./bin/linux/x86_64/server /opt/echovault/bin
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

Expand All @@ -27,7 +46,6 @@ CMD "./server" \
"--eviction-interval" "${EVICTION_INTERVAL}" \
"--tls=${TLS}" \
"--mtls=${MTLS}" \
"--in-memory=${IN_MEMORY}" \
"--bootstrap-cluster=${BOOTSTRAP_CLUSTER}" \
"--acl-config=${ACL_CONFIG}" \
"--require-pass=${REQUIRE_PASS}" \
Expand Down
Loading