From 368e2e926b32991c3e6757c5c03f750de3d132d4 Mon Sep 17 00:00:00 2001 From: Russia9 Date: Sun, 13 Mar 2022 10:39:58 +0300 Subject: [PATCH] Dockerfile --- Dockerfile | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8333b05..a14a0f3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,24 @@ -FROM alpine:3.11.6 AS build -RUN apk add --no-cache go +# Build container +FROM golang:1.17-bullseye AS build + +# Set build workdir WORKDIR /app + +# Copy app sources COPY . . -RUN CGO_ENABLED=1 GOOS=linux go build -o app -tags musl cw-deals-watcher -FROM alpine:3.11.6 +# Build app +RUN go build -o app . + +# --- +# Production container +FROM debian:bullseye-slim + +# Set app workdir WORKDIR /app -COPY --from=build /app/app /app/app -CMD ["/app/app"] + +# Copy binary +COPY --from=build /app/app . + +# Run app +CMD ["./app"]