From 5ba14d98c3cbb5ba97a5019be22fddeb19a7a415 Mon Sep 17 00:00:00 2001 From: Vladimir Hodakov Date: Tue, 8 Oct 2019 06:17:07 +0400 Subject: [PATCH] Add Dockerfile for container build --- .drone.yml | 11 ++++++++++- Dockerfile | 14 ++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/.drone.yml b/.drone.yml index 2d3e8c6..fffa4b0 100644 --- a/.drone.yml +++ b/.drone.yml @@ -14,4 +14,13 @@ steps: commands: - golangci-lint -v run environment: - GOFLAGS: -mod=vendor \ No newline at end of file + GOFLAGS: -mod=vendor +- name: build + image: plugins/docker + settings: + username: + from_secret: registry_user + password: + from_secret: registry_password + repo: fat0troll/fwzookeeper_helper + auto_tag: true \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9b43f09 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM fat0troll/tdlib-golangci AS builder + +COPY . /build/ +WORKDIR /build/ + +RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 GOFLAGS='-mod=vendor' go build -ldflags '-w -extldflags "-static"' + +FROM scratch + +COPY --from=builder /build/fwzookeeper_helper /usr/local/bin/fw_zookeeper_helper + +VOLUME ["/data"] + +ENTRYPOINT [ "/usr/local/bin/fw_zookeeper_helper" ] \ No newline at end of file