From 07237f62c8e9624910a2065d78ebd02146a2184a Mon Sep 17 00:00:00 2001 From: Yukine Date: Thu, 4 Feb 2021 00:30:37 +0100 Subject: [PATCH] chore(Docker): add docker support --- .dockerignore | 4 ++++ Dockerfile | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..0dfd44d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +Dockerfile +.gitignore +LICENSE.md +README.md \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..97c6612 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM golang:alpine AS build-base + +WORKDIR /tmp/DigitalOceanSnapshotter + +COPY go.mod . +COPY go.sum . + +RUN go mod download + +COPY cmd ./cmd + +RUN go build -o ./out ./cmd/DigitalOceanSnapshotter + +FROM alpine:3.9 +RUN apk add ca-certificates + +COPY --from=build-base /tmp/DigitalOceanSnapshotter/out /app/DigitalOceanSnapshotter + +RUN ["chmod", "+x", "/app/DigitalOceanSnapshotter"] + +CMD ["/app/DigitalOceanSnapshotter"] \ No newline at end of file