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.

79 lines
1.9 KiB

  1. ARG PYTHON_VERSION="3.8.12-slim-buster"
  2. ARG NODE_VERSION="16.5-alpine3.14"
  3. FROM node:${NODE_VERSION} 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} AS backend-builder
  13. RUN apt-get update \
  14. && apt-get install -y --no-install-recommends \
  15. netcat=1.* \
  16. libpq-dev=11.* \
  17. unixodbc-dev=2.* \
  18. g++=4:* \
  19. libssl-dev=1.* \
  20. && apt-get clean
  21. WORKDIR /tmp
  22. COPY Pipfile* /tmp/
  23. # hadolint ignore=DL3013
  24. RUN pip install --upgrade pip \
  25. && pip install --no-cache-dir --upgrade pipenv \
  26. && pipenv lock -r > /requirements.txt \
  27. && echo "psycopg2-binary==2.8.6" >> /requirements.txt \
  28. && echo "django-heroku==0.3.1" >> /requirements.txt \
  29. && pip install --no-cache-dir -r /requirements.txt \
  30. && pip wheel --no-cache-dir -r /requirements.txt -w /deps
  31. FROM python:${PYTHON_VERSION} AS runtime
  32. RUN apt-get update \
  33. && apt-get install -y --no-install-recommends \
  34. libpq-dev \
  35. unixodbc-dev=2.* \
  36. libssl-dev=1.* \
  37. && apt-get clean
  38. RUN useradd -ms /bin/sh doccano
  39. RUN mkdir /data \
  40. && chown doccano:doccano /data
  41. COPY --from=backend-builder /deps /deps
  42. # hadolint ignore=DL3013
  43. RUN pip install --no-cache-dir -U pip \
  44. && pip install --no-cache-dir /deps/*.whl \
  45. && rm -rf /deps
  46. COPY --chown=doccano:doccano . /doccano
  47. WORKDIR /doccano/backend
  48. COPY --from=frontend-builder /frontend/dist /doccano/backend/client/dist
  49. RUN python manage.py collectstatic --noinput
  50. RUN chown -R doccano:doccano .
  51. VOLUME /data
  52. ENV DATABASE_URL="sqlite:////data/doccano.db"
  53. ENV DEBUG="False"
  54. ENV STANDALONE="True"
  55. ENV SECRET_KEY="change-me-in-production"
  56. ENV PORT="8000"
  57. ENV WORKERS="2"
  58. ENV CELERY_WORKERS="2"
  59. ENV GOOGLE_TRACKING_ID=""
  60. ENV AZURE_APPINSIGHTS_IKEY=""
  61. USER doccano
  62. EXPOSE ${PORT}
  63. CMD ["/doccano/tools/run.sh"]