Skip to content

Commit

Permalink
Finished implementing multi stage build
Browse files Browse the repository at this point in the history
  • Loading branch information
DMcP89 committed Jun 13, 2024
1 parent 3c2b722 commit 57d4718
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -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

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 build


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 Down

0 comments on commit 57d4718

Please sign in to comment.