Dockerfile 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. # Install Google Cloud Debugger agent
  26. RUN mkdir /opt/cdbg && \
  27. wget -qO- https://storage.googleapis.com/cloud-debugger/compute-java/debian-wheezy/cdbg_java_agent_gce.tar.gz | \
  28. tar xvz -C /opt/cdbg
  29. RUN useradd --create-home node
  30. COPY --from=builder /git-bridge.jar /
  31. COPY vendor/envsubst /opt/envsubst
  32. RUN chmod +x /opt/envsubst
  33. COPY conf/envsubst_template.json envsubst_template.json
  34. COPY start.sh start.sh
  35. COPY server-pro-start.sh server-pro-start.sh
  36. RUN mkdir conf
  37. RUN chown node:node conf
  38. USER node
  39. CMD ["/start.sh"]