From 30a5d407e204a591260fc8b793ed1d1e65699c84 Mon Sep 17 00:00:00 2001 From: Timur Demin Date: Sat, 21 Nov 2020 23:19:34 +0500 Subject: [PATCH] Add Docker build files --- .drone.yml | 17 +++++++++++++++++ Dockerfile | 23 +++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 Dockerfile diff --git a/.drone.yml b/.drone.yml index a7ce8d7..c503871 100644 --- a/.drone.yml +++ b/.drone.yml @@ -25,3 +25,20 @@ steps: - curl -sL https://git.io/goreleaser | bash when: event: tag +- name: build docker image + image: plugins/docker + settings: + username: + from_secret: username + password: + from_secret: password + repo: registry.git.tdem.in/gmnhg + registry: registry.git.tdem.in + dockerfile: Dockerfile + tags: + - ${DRONE_TAG} + - latest + when: + event: + - tag + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3026076 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM golang:1.15-alpine AS builder + +WORKDIR /src + +ENV CGO_ENABLED=0 +ENV GO111MODULE=on +ENV GOFLAGS="-trimpath -ldflags=-linkmode=external" + +RUN apk add --no-cache git gcc musl-dev + +COPY . /src/ + +RUN \ + go build -v -o /tmp/gmnhg ./cmd/gmnhg && \ + go build -v -o /tmp/md2gmn ./cmd/md2gmn + +FROM alpine:3.12 AS runner + +LABEL maintainer "Timur Demin " + +COPY --from=builder /tmp/gmnhg /tmp/md2gmn /bin/ + +CMD ["/bin/sh"]