From 9a38b11c37f9213ba5a705913dd8e4c5389ad36d Mon Sep 17 00:00:00 2001 From: Matt Stobo Date: Sun, 30 Dec 2018 17:17:17 -0500 Subject: [PATCH] Update Dockerfile for go modules --- Dockerfile | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/Dockerfile b/Dockerfile index dd2ab239..4c9e473f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,33 +1,17 @@ -FROM alpine:3.6 +FROM golang:1.11-alpine -ARG version=0.4.1 -ARG buildhost=https://github.com/mwstobo/airhornbot/archive -ARG buildfile=cmd/bot/bot.go -ARG tar_filename=${version}.tar.gz - -ENV GOPATH=/root/go -ENV AIRHORN_SRC=$GOPATH/src/github.com/mwstobo/airhornbot +WORKDIR /opt/airhornbot +COPY . . RUN apk update \ - && apk add --no-cache \ - ca-certificates \ && apk add --no-cache \ --virtual build \ - wget \ - go \ - glide \ + gcc \ git \ - musl-dev \ - && update-ca-certificates \ - && wget ${buildhost}/${tar_filename} \ - && mkdir -p $AIRHORN_SRC \ - && tar xvf "${tar_filename}" -C $AIRHORN_SRC --strip 1 \ - && rm "${tar_filename}" \ - && cd $AIRHORN_SRC \ - && glide install \ - && go build ${buildfile} \ + musl-dev + +RUN go mod vendor \ + && go build cmd/bot/bot.go \ && apk del build -WORKDIR $AIRHORN_SRC -CMD ["./bot", \ - "-t YOUR_TOKEN_HERE"] +CMD ["./bot", "-t YOUR_TOKEN_HERE"]