44 lines
1.0 KiB

4 years ago
  1. # Build go-neb
  2. FROM golang:1.18-alpine as builder
  3. RUN apk add --no-cache -t build-deps git gcc musl-dev go make cmake g++
  4. RUN git clone https://gitlab.matrix.org/matrix-org/olm.git /tmp/libolm \
  5. && cd /tmp/libolm \
  6. && cmake . -Bbuild \
  7. && cmake --build build --target install
  8. COPY . /tmp/go-neb
  9. WORKDIR /tmp/go-neb
  10. RUN go install honnef.co/go/tools/cmd/staticcheck@latest \
  11. && go install github.com/fzipp/gocyclo/cmd/gocyclo@latest \
  12. && go build github.com/matrix-org/go-neb
  13. # Ensures we're lint-free
  14. RUN /tmp/go-neb/hooks/pre-commit
  15. # Run go-neb
  16. FROM alpine:3.13
  17. ENV BIND_ADDRESS=:4050 \
  18. DATABASE_TYPE=sqlite3 \
  19. DATABASE_URL=/data/go-neb.db?_busy_timeout=5000 \
  20. UID=1337 \
  21. GID=1337
  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/"]