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.8 KiB

5 years ago
  1. ARG PYTHON_VERSION="3.6"
  2. FROM python:${PYTHON_VERSION}-stretch AS builder
  3. SHELL ["/bin/bash", "-o", "pipefail", "-c"]
  4. ARG NODE_VERSION="8.x"
  5. # hadolint ignore=DL3008
  6. RUN curl -sL "https://deb.nodesource.com/setup_${NODE_VERSION}" | bash - \
  7. && apt-get install --no-install-recommends -y \
  8. nodejs
  9. ARG HADOLINT_VERSION=v1.17.1
  10. RUN curl -fsSL "https://github.com/hadolint/hadolint/releases/download/${HADOLINT_VERSION}/hadolint-Linux-$(uname -m)" -o /usr/local/bin/hadolint \
  11. && chmod +x /usr/local/bin/hadolint
  12. COPY tools/install-mssql.sh /doccano/tools/install-mssql.sh
  13. RUN /doccano/tools/install-mssql.sh --dev
  14. COPY app/server/static/package*.json /doccano/app/server/static/
  15. WORKDIR /doccano/app/server/static
  16. RUN npm ci
  17. COPY requirements.txt /
  18. RUN pip install -r /requirements.txt \
  19. && pip wheel -r /requirements.txt -w /deps
  20. COPY Dockerfile /
  21. RUN hadolint /Dockerfile
  22. COPY . /doccano
  23. WORKDIR /doccano
  24. RUN tools/ci.sh
  25. FROM builder AS cleaner
  26. WORKDIR /doccano/app/server/static
  27. RUN SOURCE_MAP=False DEBUG=False npm run build \
  28. && rm -rf components pages node_modules .*rc package*.json webpack.config.js
  29. WORKDIR /doccano
  30. RUN python app/manage.py collectstatic --noinput
  31. FROM python:${PYTHON_VERSION}-slim-stretch AS runtime
  32. COPY --from=builder /doccano/tools/install-mssql.sh /doccano/tools/install-mssql.sh
  33. RUN /doccano/tools/install-mssql.sh
  34. RUN useradd -ms /bin/sh doccano
  35. COPY --from=builder /deps /deps
  36. # hadolint ignore=DL3013
  37. RUN pip install --no-cache-dir /deps/*.whl
  38. COPY --from=cleaner --chown=doccano:doccano /doccano /doccano
  39. ENV DEBUG="True"
  40. ENV SECRET_KEY="change-me-in-production"
  41. ENV PORT="8000"
  42. ENV WORKERS="2"
  43. ENV GOOGLE_TRACKING_ID=""
  44. ENV AZURE_APPINSIGHTS_IKEY=""
  45. USER doccano
  46. WORKDIR /doccano
  47. EXPOSE ${PORT}
  48. CMD ["/doccano/tools/run.sh"]