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.

68 lines
1.9 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. RUN apt-get install --no-install-recommends -y \
  8. unixodbc-dev=2.3.4-1
  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. RUN apt-get update \
  26. && apt-get install --no-install-recommends -y \
  27. curl=7.52.1-5+deb9u9 \
  28. gnupg=2.1.18-8~deb9u4 \
  29. apt-transport-https=1.4.9 \
  30. && curl -fsS https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
  31. && curl -fsS https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql.list \
  32. && apt-get update \
  33. && ACCEPT_EULA=Y apt-get install --no-install-recommends -y \
  34. msodbcsql17=17.3.1.1-1 \
  35. mssql-tools=17.3.0.1-1 \
  36. && apt-get remove -y curl gnupg apt-transport-https \
  37. && rm -rf /var/lib/apt/lists/*
  38. RUN useradd -ms /bin/sh doccano
  39. COPY --from=builder /deps /deps
  40. RUN pip install --no-cache-dir /deps/*.whl
  41. COPY --from=cleaner --chown=doccano:doccano /doccano /doccano
  42. ENV DEBUG="True"
  43. ENV SECRET_KEY="change-me-in-production"
  44. ENV PORT="8000"
  45. ENV WORKERS="2"
  46. ENV GOOGLE_TRACKING_ID=""
  47. ENV AZURE_APPINSIGHTS_IKEY=""
  48. USER doccano
  49. WORKDIR /doccano
  50. EXPOSE ${PORT}
  51. CMD ["/doccano/tools/run.sh"]