You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.2KB

  1. ## lint image
  2. FROM golangci/golangci-lint@sha256:9ae3767101cd3468cdaea5b6573dadb358013e05ac38abe37d53646680fd386c AS linter
  3. RUN mkdir -p /go/src/git.eeqj.de/sneak/historyposter
  4. WORKDIR /go/src/git.eeqj.de/sneak/historyposter
  5. COPY ./ ./
  6. RUN golangci-lint run
  7. ## build image:
  8. #ARG GO_VERSION=1.15
  9. FROM golang:1.15-alpine AS builder
  10. RUN mkdir /user && \
  11. echo 'nobody:x:65534:65534:nobody:/:' > /user/passwd && \
  12. echo 'nobody:x:65534:' > /user/group
  13. RUN apk add --no-cache ca-certificates git bzip2 make gcc libc-dev
  14. #RUN GO111MODULE=on go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.31.0
  15. RUN mkdir -p /go/src/git.eeqj.de/sneak/historyposter
  16. WORKDIR /go/src/git.eeqj.de/sneak/historyposter
  17. COPY go.mod .
  18. COPY go.sum .
  19. RUN go mod download
  20. COPY ./ ./
  21. #RUN make lint
  22. RUN make build
  23. RUN tar -c /go | bzip2 > /go.tbz2
  24. ## output image:
  25. FROM scratch AS final
  26. COPY --from=builder /user/group /user/passwd /etc/
  27. COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
  28. COPY --from=builder /go/src/git.eeqj.de/sneak/historyposter/historyposterd /app/historyposterd
  29. COPY --from=builder /go.tbz2 /go.tbz2
  30. WORKDIR /app
  31. ENV PORT 8080
  32. ENV DBURL none
  33. EXPOSE 8080
  34. USER nobody:nobody
  35. ENTRYPOINT ["./historyposterd"]