Dockerfile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Dockerfile for git-bridge
  2. FROM maven:3-jdk-11 as base
  3. RUN apt-get update && apt-get install -y make git sqlite3 \
  4. && rm -rf /var/lib/apt/lists
  5. COPY vendor/envsubst /opt/envsubst
  6. RUN chmod +x /opt/envsubst
  7. RUN useradd --create-home node
  8. FROM base as builder
  9. COPY . /app
  10. WORKDIR /app
  11. RUN make package \
  12. # The name of the created jar contains the current version tag.
  13. # Rename it to a static path that can be used for copying.
  14. && find /app/target \
  15. -name 'writelatex-git-bridge*jar-with-dependencies.jar' \
  16. -exec mv {} /git-bridge.jar \;
  17. FROM openjdk:11-jre
  18. RUN apt-get update && apt-get install -y git sqlite3 procps htop net-tools sockstat libjemalloc2 \
  19. && rm -rf /var/lib/apt/lists
  20. ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2
  21. # Install Google Cloud Profiler agent
  22. RUN mkdir -p /opt/cprof && \
  23. wget -q -O- https://storage.googleapis.com/cloud-profiler/java/latest/profiler_java_agent.tar.gz \
  24. | tar xzv -C /opt/cprof
  25. RUN useradd --create-home node
  26. COPY --from=builder /git-bridge.jar /
  27. COPY vendor/envsubst /opt/envsubst
  28. RUN chmod +x /opt/envsubst
  29. COPY conf/envsubst_template.json envsubst_template.json
  30. COPY start.sh start.sh
  31. COPY server-pro-start.sh server-pro-start.sh
  32. RUN mkdir conf
  33. RUN chown node:node conf
  34. USER node
  35. CMD ["/start.sh"]