blob: f3039287f1fa03afe3095a18fd3db3cca8d072d1 [file] [log] [blame]
FROM golang:latest as builder
ENV CGO_ENABLED=0
ENV GO111MODULE=on
ENV GOPROXY=https://proxy.golang.org
RUN mkdir /gocache
ENV GOCACHE /gocache
COPY go.mod /go/src/gomodules.avm99963.com/hichip2mqtt/go.mod
COPY go.sum /go/src/gomodules.avm99963.com/hichip2mqtt/go.sum
WORKDIR /go/src/gomodules.avm99963.com/hichip2mqtt
# Optimization for iterative docker build speed, not necessary for correctness:
RUN go install github.com/eclipse/paho.mqtt.golang
RUN go install github.com/flashmob/go-guerrilla
RUN go install github.com/go-sql-driver/mysql
RUN go install github.com/sirupsen/logrus
RUN go install github.com/spf13/cobra
RUN go install gomodules.avm99963.com/forks/parsemail
WORKDIR /go/src/gomodules.avm99963.com/hichip2mqtt/cmd/hichipbridge
COPY . /go/src/gomodules.avm99963.com/hichip2mqtt/cmd/hichipbridge
RUN go install gomodules.avm99963.com/hichip2mqtt/cmd/hichipbridge
FROM alpine
LABEL maintainer "me@avm99963.com"
RUN apk add --no-cache tini
COPY --from=builder /go/bin/hichipbridge /
ENTRYPOINT ["/sbin/tini", "--", "/hichipbridge", "serve"]