You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.3 KiB

  1. ARG PYTHON_VERSION="3.6"
  2. FROM python:${PYTHON_VERSION} AS builder
  3. ARG NODE_VERSION="8.x"
  4. RUN curl -sL "https://deb.nodesource.com/setup_${NODE_VERSION}" | bash - \
  5. && apt-get install nodejs \
  6. && rm -rf /var/lib/apt/lists/*
  7. COPY app/server/package*.json /doccano/app/server/
  8. RUN cd /doccano/app/server \
  9. && npm ci
  10. COPY requirements.txt /
  11. RUN pip install -r /requirements.txt \
  12. && pip wheel -r /requirements.txt -w /deps
  13. COPY app/server/static /doccano/app/server/static/
  14. COPY app/server/webpack.config.js /doccano/app/server/
  15. RUN cd /doccano/app/server \
  16. && DEBUG=False npm run build
  17. COPY . /doccano
  18. RUN cd /doccano \
  19. && tools/ci.sh
  20. FROM builder AS cleaner
  21. RUN cd /doccano \
  22. && python app/manage.py collectstatic --noinput
  23. RUN rm -rf /doccano/app/server/node_modules/ \
  24. && rm -rf /doccano/app/server/static/ \
  25. && rm -rf /doccano/app/staticfiles/js/ \
  26. && find /doccano/app/staticfiles -type f -name '*.map*' -delete
  27. FROM python:${PYTHON_VERSION}-slim AS runtime
  28. COPY --from=builder /deps /deps
  29. RUN pip install --no-cache-dir /deps/*.whl
  30. COPY --from=cleaner /doccano /doccano
  31. ENV DEBUG="True"
  32. ENV SECRET_KEY="change-me-in-production"
  33. ENV PORT="80"
  34. ENV WORKERS="2"
  35. ENV GOOGLE_TRACKING_ID=""
  36. ENV AZURE_APPINSIGHTS_IKEY=""
  37. WORKDIR /doccano
  38. EXPOSE ${PORT}
  39. CMD ["/doccano/tools/run.sh"]