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.

67 lines
1.6 KiB

  1. ARG PYTHON_VERSION="3.8.6"
  2. ARG NODE_VERSION="13.7"
  3. FROM node:${NODE_VERSION}-alpine AS frontend-builder
  4. COPY frontend/ /frontend/
  5. WORKDIR /frontend
  6. ENV PUBLIC_PATH="/static/_nuxt/"
  7. # hadolint ignore=DL3018
  8. RUN apk add -U --no-cache git python3 make g++ \
  9. && yarn install \
  10. && yarn build \
  11. && apk del --no-cache git make g++
  12. FROM python:${PYTHON_VERSION}-slim-buster AS backend-builder
  13. RUN apt-get update \
  14. && apt-get install -y --no-install-recommends \
  15. netcat=1.10-41.1 \
  16. libpq-dev=11.9-0+deb10u1 \
  17. unixodbc-dev=2.3.6-0.1 \
  18. g++=4:8.3.0-1 \
  19. libssl-dev=1.1.1d-0+deb10u4 \
  20. && apt-get clean
  21. WORKDIR /tmp
  22. COPY Pipfile* /tmp/
  23. # hadolint ignore=DL3013
  24. RUN pip install --no-cache-dir -U pip pipenv==2020.11.15 \
  25. && pipenv lock -r > /requirements.txt \
  26. && pip install --no-cache-dir -r /requirements.txt \
  27. && pip wheel --no-cache-dir -r /requirements.txt -w /deps
  28. FROM python:${PYTHON_VERSION}-slim-buster AS runtime
  29. RUN useradd -ms /bin/sh doccano
  30. RUN mkdir /data \
  31. && chown doccano:doccano /data
  32. COPY --from=backend-builder /deps /deps
  33. # hadolint ignore=DL3013
  34. RUN pip install --no-cache-dir -U pip \
  35. && pip install --no-cache-dir /deps/*.whl \
  36. && rm -rf /deps
  37. COPY --chown=doccano:doccano . /doccano
  38. WORKDIR /doccano
  39. COPY --from=frontend-builder /frontend/dist /doccano/app/client/dist
  40. RUN python app/manage.py collectstatic --noinput
  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"]