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.

50 lines
1.1 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. COPY app/server/static/package*.json /doccano/app/server/static/
  7. RUN cd /doccano/app/server/static \
  8. && npm ci
  9. COPY requirements.txt /
  10. RUN pip install -r /requirements.txt \
  11. && pip wheel -r /requirements.txt -w /deps
  12. COPY . /doccano
  13. RUN cd /doccano \
  14. && tools/ci.sh
  15. FROM builder AS cleaner
  16. RUN cd /doccano/app/server/static \
  17. && SOURCE_MAP=False DEBUG=False npm run build \
  18. && rm -rf components pages node_modules .*rc package*.json webpack.config.js
  19. RUN cd /doccano \
  20. && python app/manage.py collectstatic --noinput
  21. FROM python:${PYTHON_VERSION}-slim AS runtime
  22. RUN useradd -ms /bin/sh doccano
  23. COPY --from=builder /deps /deps
  24. RUN pip install --no-cache-dir /deps/*.whl
  25. COPY --from=cleaner --chown=doccano:doccano /doccano /doccano
  26. ENV DEBUG="True"
  27. ENV SECRET_KEY="change-me-in-production"
  28. ENV PORT="8000"
  29. ENV WORKERS="2"
  30. ENV GOOGLE_TRACKING_ID=""
  31. ENV AZURE_APPINSIGHTS_IKEY=""
  32. USER doccano
  33. WORKDIR /doccano
  34. EXPOSE ${PORT}
  35. CMD ["/doccano/tools/run.sh"]