Dockerfile 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # Dockerfile for git-bridge
  2. FROM maven:3-amazoncorretto-21-debian 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 amazoncorretto:21-alpine
  18. RUN apk add --update --no-cache bash git sqlite procps htop net-tools jemalloc
  19. ENV LD_PRELOAD=/usr/lib/libjemalloc.so.2
  20. # Install Google Cloud Profiler agent
  21. RUN mkdir -p /opt/cprof && \
  22. wget -q -O- https://storage.googleapis.com/cloud-profiler/java/latest/profiler_java_agent.tar.gz \
  23. | tar xzv -C /opt/cprof
  24. RUN adduser -D node
  25. COPY --from=builder /git-bridge.jar /
  26. COPY vendor/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"]