From f17fb582e24bf00f2c7f2f55851e52a92143435a Mon Sep 17 00:00:00 2001 From: darmiel <71837281+darmiel@users.noreply.github.com> Date: Sat, 3 Apr 2021 15:12:00 +0200 Subject: [PATCH] Added Dockerfile --- Dockerfile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a863b10 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM golang:latest AS builder + +LABEL maintainer="darmiel " +WORKDIR /usr/src/app + +# Install dependencies +# Thanks to @montanaflynn +# https://github.com/montanaflynn/golang-docker-cache +COPY go.mod go.sum ./ +RUN go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get + +# Copy remaining source +COPY . . + +# Build from sources +RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o yaxc . + +# Output Image +FROM alpine +COPY --from=builder /usr/src/app/yaxc . +RUN ls -larth / +ENTRYPOINT ["/yaxc"]