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.

74 lines
1.9 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 --no-cache-dir -r /requirements.txt \
  19. && pip wheel --no-cache-dir -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. RUN mkdir /data \
  36. && chown doccano:doccano /data
  37. COPY --from=builder /deps /deps
  38. # hadolint ignore=DL3013
  39. RUN pip install --no-cache-dir /deps/*.whl
  40. COPY --from=cleaner --chown=doccano:doccano /doccano /doccano
  41. VOLUME /data
  42. ENV DATABASE_URL="sqlite:////data/doccano.db"
  43. ENV DEBUG="True"
  44. ENV SECRET_KEY="change-me-in-production"
  45. ENV PORT="8000"
  46. ENV WORKERS="2"
  47. ENV GOOGLE_TRACKING_ID=""
  48. ENV AZURE_APPINSIGHTS_IKEY=""
  49. USER doccano
  50. WORKDIR /doccano
  51. EXPOSE ${PORT}
  52. CMD ["/doccano/tools/run.sh"]