From 452152ad11e5350036daf88857a7ff9b61963433 Mon Sep 17 00:00:00 2001 From: jonaustin09 Date: Mon, 27 Nov 2023 14:23:52 -0500 Subject: [PATCH] feat: Added multistage build, removed unnecessary stuff from final image by only leaving the built binary. Added env variables reading instructions in Makefile --- Dockerfile | 6 +++++- Makefile | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 23830a79..2cf439a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,10 @@ COPY ./ ./ WORKDIR /app/cmd/versitygw RUN go build -o versitygw +FROM alpine:latest + RUN mkdir /tmp/vgw -ENTRYPOINT [ "./versitygw" ] \ No newline at end of file +COPY --from=0 /app/cmd/versitygw/versitygw /app/versitygw + +ENTRYPOINT [ "/app/versitygw" ] \ No newline at end of file diff --git a/Makefile b/Makefile index 97f72209..a3728458 100644 --- a/Makefile +++ b/Makefile @@ -78,12 +78,12 @@ dist: $(BIN).spec # Creates and runs S3 gateway instance in a docker container .PHONY: up-posix up-posix: - docker compose up posix + docker compose --env-file .env.dev up posix # Creates and runs S3 gateway proxy instance in a docker container .PHONY: up-proxy up-proxy: - docker compose up proxy + docker compose --env-file .env.dev up proxy # Creates and runs both S3 gateway and proxy server instances in docker containers .PHONY: up-app