From 3c2b7220d357ce8972f03aab62039f446b19ec37 Mon Sep 17 00:00:00 2001 From: DMcP89 Date: Wed, 12 Jun 2024 22:17:49 -0400 Subject: [PATCH 1/3] Starting to implement build stage for Dockerfile.dev --- Dockerfile.dev | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Dockerfile.dev b/Dockerfile.dev index 9dc85eb..e1fc1dc 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,4 +1,13 @@ -FROM --platform=linux/amd64 alpine:latest +FROM --platform=linux/amd64 golang:alpine as build + +RUN apk add --no-cache musl-dev +WORKDIR /build +COPY . ./ +ENV CGO_ENABLED=1 CC=x86_64-linux-musl-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 + +FROM --platform=linux/amd64 build RUN mkdir -p /usr/local/lib/echovault RUN mkdir -p /opt/echovault/bin From 57d471852838de0fab8090dc88573723ba4c6212 Mon Sep 17 00:00:00 2001 From: DMcP89 Date: Thu, 13 Jun 2024 09:34:28 -0400 Subject: [PATCH 2/3] Finished implementing multi stage build --- Dockerfile.dev | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Dockerfile.dev b/Dockerfile.dev index e1fc1dc..894465c 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,20 +1,30 @@ FROM --platform=linux/amd64 golang:alpine as build -RUN apk add --no-cache musl-dev +RUN apk add --no-cache gcc musl-dev + WORKDIR /build COPY . ./ -ENV CGO_ENABLED=1 CC=x86_64-linux-musl-gcc GOOS=linux GOARCH=amd64 + +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 -FROM --platform=linux/amd64 build +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 From 168e7608a55978ae9bd1399a5a9e0835eb3d0233 Mon Sep 17 00:00:00 2001 From: Kelvin Mwinuka Date: Thu, 13 Jun 2024 22:12:19 +0800 Subject: [PATCH 3/3] Removed `--in-memory` flag as it's will no longer be used. --- Dockerfile.dev | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile.dev b/Dockerfile.dev index 894465c..9f097dd 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -46,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}" \