Dockerfile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Build the a8m/envsubst binary, as it supports default values,
  2. # which the gnu envsubst (from gettext-base) does not.
  3. FROM golang:1.25.5-alpine AS envsubst_builder
  4. WORKDIR /build
  5. RUN go install github.com/a8m/envsubst/cmd/envsubst@latest
  6. FROM maven:3-amazoncorretto-21-debian AS base
  7. RUN apt-get update && apt-get install -y make git sqlite3 \
  8. && rm -rf /var/lib/apt/lists
  9. COPY --from=envsubst_builder /go/bin/envsubst /opt/envsubst
  10. RUN chmod +x /opt/envsubst
  11. RUN useradd --create-home node
  12. FROM base AS builder
  13. COPY . /app
  14. WORKDIR /app
  15. RUN make package \
  16. # The name of the created jar contains the current version tag.
  17. # Rename it to a static path that can be used for copying.
  18. && find /app/target \
  19. -name 'writelatex-git-bridge*jar-with-dependencies.jar' \
  20. -exec mv {} /git-bridge.jar \;
  21. FROM amazoncorretto:21-alpine
  22. RUN apk add --update --no-cache bash git sqlite procps htop net-tools jemalloc util-linux
  23. ENV LD_PRELOAD=/usr/lib/libjemalloc.so.2
  24. RUN adduser -D node
  25. COPY --from=builder /git-bridge.jar /
  26. COPY --from=envsubst_builder /go/bin/envsubst /opt/envsubst
  27. RUN chmod +x /opt/envsubst
  28. COPY conf/envsubst_template.json envsubst_template.json
  29. COPY start.sh start.sh
  30. COPY server-pro-start.sh server-pro-start.sh
  31. RUN mkdir conf
  32. RUN chown node:node conf
  33. USER node
  34. CMD ["/start.sh"]