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.

72 lines
1.8 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 useradd -ms /bin/sh doccano
  33. RUN mkdir /data \
  34. && chown doccano:doccano /data
  35. COPY --from=backend-builder /deps /deps
  36. # hadolint ignore=DL3013
  37. RUN pip install --no-cache-dir -U pip \
  38. && pip install --no-cache-dir /deps/*.whl \
  39. && rm -rf /deps
  40. COPY --chown=doccano:doccano . /doccano
  41. WORKDIR /doccano/backend
  42. COPY --from=frontend-builder /frontend/dist /doccano/backend/client/dist
  43. RUN python manage.py collectstatic --noinput
  44. RUN chown -R doccano:doccano .
  45. VOLUME /data
  46. ENV DATABASE_URL="sqlite:////data/doccano.db"
  47. ENV DEBUG="False"
  48. ENV STANDALONE="True"
  49. ENV SECRET_KEY="change-me-in-production"
  50. ENV PORT="8000"
  51. ENV WORKERS="2"
  52. ENV CELERY_WORKERS="2"
  53. ENV GOOGLE_TRACKING_ID=""
  54. ENV AZURE_APPINSIGHTS_IKEY=""
  55. USER doccano
  56. EXPOSE ${PORT}
  57. CMD ["/doccano/tools/run.sh"]