Skip to content

Commit

Permalink
Update Dockerfile for go modules
Browse files Browse the repository at this point in the history
  • Loading branch information
mwstobo committed Dec 30, 2018
1 parent 604e9aa commit 9a38b11
Showing 1 changed file with 9 additions and 25 deletions.
34 changes: 9 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit 9a38b11

Please sign in to comment.