Dockerfile 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 build-essential dpkg-dev
  4. RUN echo "deb-src http://deb.debian.org/debian buster main" >> /etc/apt/sources.list && \
  5. echo "deb-src http://deb.debian.org/debian buster-updates main" >> /etc/apt/sources.list && \
  6. echo "deb-src http://security.debian.org/debian-security buster/updates main" >> /etc/apt/sources.list
  7. RUN mkdir -p /build
  8. WORKDIR /build
  9. RUN apt-get update && \
  10. apt-get -y source libjemalloc-dev && \
  11. apt-get -y build-dep libjemalloc-dev && \
  12. echo "override_dh_auto_configure:" >> jemalloc-5.1.0/debian/rules && \
  13. echo "\tdh_auto_configure -- --enable-debug --enable-fill --enable-prof --enable-stat" >> jemalloc-5.1.0/debian/rules && \
  14. cat jemalloc-5.1.0/debian/rules
  15. WORKDIR /build/jemalloc-5.1.0
  16. RUN dpkg-buildpackage
  17. RUN rm -rf /var/lib/apt/lists
  18. COPY vendor/envsubst /opt/envsubst
  19. RUN chmod +x /opt/envsubst
  20. RUN useradd --create-home node
  21. FROM base as builder
  22. COPY . /app
  23. WORKDIR /app
  24. RUN make package \
  25. # The name of the created jar contains the current version tag.
  26. # Rename it to a static path that can be used for copying.
  27. && find /app/target \
  28. -name 'writelatex-git-bridge*jar-with-dependencies.jar' \
  29. -exec mv {} /git-bridge.jar \;
  30. FROM openjdk:11-jre
  31. RUN apt-get update && apt-get install -y git sqlite3 procps htop net-tools sockstat \
  32. && rm -rf /var/lib/apt/lists
  33. # Install Google Cloud Profiler agent
  34. RUN mkdir -p /opt/cprof && \
  35. wget -q -O- https://storage.googleapis.com/cloud-profiler/java/latest/profiler_java_agent.tar.gz \
  36. | tar xzv -C /opt/cprof
  37. # Install Google Cloud Debugger agent
  38. RUN mkdir /opt/cdbg && \
  39. wget -qO- https://storage.googleapis.com/cloud-debugger/compute-java/debian-wheezy/cdbg_java_agent_gce.tar.gz | \
  40. tar xvz -C /opt/cdbg
  41. RUN useradd --create-home node
  42. COPY --from=builder /git-bridge.jar /
  43. COPY --from=builder /build/*.deb /tmp/
  44. RUN dpkg -i /tmp/libjemalloc*.deb
  45. COPY vendor/envsubst /opt/envsubst
  46. RUN chmod +x /opt/envsubst
  47. COPY conf/envsubst_template.json envsubst_template.json
  48. COPY start.sh start.sh
  49. RUN mkdir conf
  50. RUN chown node:node conf
  51. USER node
  52. CMD ["/start.sh"]