blob: 4e697119d08469ed09006ef58f7ead4229530508 [file] [log] [blame]
FROM golang:latest@sha256:672a2286da3ee7a854c3e0a56e0838918d0dbb1c18652992930293312de898a6 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/minio/minio-go/v7
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@sha256:51b67269f354137895d43f3b3d810bfacd3945438e94dc5ac55fdac340352f48
LABEL maintainer "me@avm99963.com"
RUN apk add --no-cache tini
COPY --from=builder /go/bin/hichipbridge /
ENTRYPOINT ["/sbin/tini", "--", "/hichipbridge", "serve"]