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.

45 lines
1.1 KiB

4 years ago
4 years ago
  1. # Build go-neb
  2. FROM golang:1.16-alpine as builder
  3. RUN apk add --no-cache -t build-deps git gcc musl-dev go make g++
  4. RUN git clone https://gitlab.matrix.org/matrix-org/olm.git /tmp/libolm \
  5. && cd /tmp/libolm \
  6. && make install
  7. COPY . /tmp/go-neb
  8. WORKDIR /tmp/go-neb
  9. RUN go install honnef.co/go/tools/cmd/staticcheck@latest \
  10. && go install github.com/fzipp/gocyclo/cmd/gocyclo@latest \
  11. && go build github.com/matrix-org/go-neb
  12. # Ensures we're lint-free
  13. RUN /tmp/go-neb/hooks/pre-commit
  14. # Run go-neb
  15. FROM alpine:3.13
  16. ENV BIND_ADDRESS=:4050 \
  17. DATABASE_TYPE=sqlite3 \
  18. DATABASE_URL=/data/go-neb.db?_busy_timeout=5000 \
  19. UID=1337 \
  20. GID=1337
  21. HEALTHCHECK --interval=5s --timeout=3s CMD wget -qS -O /dev/null localhost${BIND_ADDRESS}/test | awk -F':' '$1 ~ / Status$/ { print $2 ~ /200 OK/ }'
  22. COPY --from=builder /tmp/go-neb/go-neb /usr/local/bin/go-neb
  23. # Copy libolm.so
  24. COPY --from=builder /usr/local/lib/* /usr/local/lib/
  25. RUN apk add --no-cache \
  26. libstdc++ \
  27. ca-certificates \
  28. su-exec \
  29. s6
  30. VOLUME /data
  31. EXPOSE 4050
  32. COPY docker/root /
  33. ENTRYPOINT ["/bin/s6-svscan", "/etc/s6.d/"]