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.

57 lines
1.4 KiB

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