avm99963 | 88e622d | 2021-01-22 18:57:58 +0100 | [diff] [blame] | 1 | FROM golang:latest as builder |
| 2 | |
| 3 | ENV CGO_ENABLED=0 |
| 4 | |
| 5 | ENV GO111MODULE=on |
| 6 | ENV GOPROXY=https://proxy.golang.org |
| 7 | |
| 8 | RUN mkdir /gocache |
| 9 | ENV GOCACHE /gocache |
| 10 | |
| 11 | COPY go.mod /go/src/gomodules.avm99963.com/hichip2mqtt/go.mod |
| 12 | COPY go.sum /go/src/gomodules.avm99963.com/hichip2mqtt/go.sum |
| 13 | |
| 14 | WORKDIR /go/src/gomodules.avm99963.com/hichip2mqtt |
| 15 | |
| 16 | # Optimization for iterative docker build speed, not necessary for correctness: |
| 17 | RUN go install github.com/eclipse/paho.mqtt.golang |
| 18 | RUN go install github.com/flashmob/go-guerrilla |
| 19 | RUN go install github.com/go-sql-driver/mysql |
| 20 | RUN go install github.com/sirupsen/logrus |
| 21 | RUN go install github.com/spf13/cobra |
| 22 | RUN go install gomodules.avm99963.com/forks/parsemail |
| 23 | |
| 24 | WORKDIR /go/src/gomodules.avm99963.com/hichip2mqtt/cmd/hichipbridge |
| 25 | |
| 26 | COPY . /go/src/gomodules.avm99963.com/hichip2mqtt/cmd/hichipbridge |
| 27 | |
| 28 | RUN go install gomodules.avm99963.com/hichip2mqtt/cmd/hichipbridge |
| 29 | |
| 30 | FROM alpine |
| 31 | LABEL maintainer "me@avm99963.com" |
| 32 | |
| 33 | RUN apk add --no-cache tini |
| 34 | COPY --from=builder /go/bin/hichipbridge / |
| 35 | ENTRYPOINT ["/sbin/tini", "--", "/hichipbridge", "serve"] |