Skip to content

Commit

Permalink
mqtt-forwarder
Browse files Browse the repository at this point in the history
replace "go get" from make file for newer go version
  • Loading branch information
Tob1as committed Feb 28, 2024
1 parent 38ee0ef commit f11ddd5
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions mqtt-forwarder.scratch.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
FROM golang:alpine AS builder
SHELL ["/bin/ash", "-euxo", "pipefail", "-c"]
ARG VERSION=master
ENV GO111MODULE=auto
WORKDIR /app
RUN apk update ; \
apk add --no-cache git make binutils ; \
git clone --branch ${VERSION} --single-branch https://git.ypbind.de/repository/mqtt-forwarder.git ; \
cd mqtt-forwarder/
WORKDIR /go/mqtt-forwarder
RUN make all
git clone --branch ${VERSION} --single-branch https://git.ypbind.de/repository/mqtt-forwarder.git
WORKDIR /app/mqtt-forwarder/src/mqtt-forwarder
# create go.mod, go.sum and then build
RUN go mod init mqtt-forwarder ; \
go mod tidy ; \
go build -o ../../bin/mqtt-forwarder .

#FROM alpine:latest
FROM scratch
Expand All @@ -27,8 +29,8 @@ LABEL org.opencontainers.image.title="mqtt-forwarder" \
org.opencontainers.image.source="https://git.ypbind.de/cgit/mqtt-forwarder/"
#RUN apk add --no-cache ca-certificates
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder --chown=1000:1000 /go/mqtt-forwarder/bin/mqtt-forwarder /usr/local/bin/mqtt-forwarder
COPY --from=builder --chown=1000:1000 /go/mqtt-forwarder/example/config.ini /etc/mqtt-forwarder/config.ini
COPY --from=builder --chown=1000:1000 /app/mqtt-forwarder/bin/mqtt-forwarder /usr/local/bin/mqtt-forwarder
COPY --from=builder --chown=1000:1000 /app/mqtt-forwarder/example/config.ini /etc/mqtt-forwarder/config.ini
USER 1000:1000
ENTRYPOINT ["mqtt-forwarder"]
#CMD ["--help"]
Expand Down

0 comments on commit f11ddd5

Please sign in to comment.