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.7 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.* \
  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 --no-cache-dir -U pip pipenv==2020.11.15 \
  25. && pipenv lock -r > /requirements.txt \
  26. && echo "psycopg2-binary==2.8.6" >> /requirements.txt \
  27. && echo "django-heroku==0.3.1" >> /requirements.txt \
  28. && pip install --no-cache-dir -r /requirements.txt \
  29. && pip wheel --no-cache-dir -r /requirements.txt -w /deps
  30. FROM python:${PYTHON_VERSION}-slim-buster AS runtime
  31. RUN useradd -ms /bin/sh doccano
  32. RUN mkdir /data \
  33. && chown doccano:doccano /data
  34. COPY --from=backend-builder /deps /deps
  35. # hadolint ignore=DL3013
  36. RUN pip install --no-cache-dir -U pip \
  37. && pip install --no-cache-dir /deps/*.whl \
  38. && rm -rf /deps
  39. COPY --chown=doccano:doccano . /doccano
  40. WORKDIR /doccano/app
  41. COPY --from=frontend-builder /frontend/dist /doccano/app/client/dist
  42. RUN python manage.py collectstatic --noinput
  43. VOLUME /data
  44. ENV DATABASE_URL="sqlite:////data/doccano.db"
  45. ENV DEBUG="True"
  46. ENV SECRET_KEY="change-me-in-production"
  47. ENV PORT="8000"
  48. ENV WORKERS="2"
  49. ENV GOOGLE_TRACKING_ID=""
  50. ENV AZURE_APPINSIGHTS_IKEY=""
  51. USER doccano
  52. EXPOSE ${PORT}
  53. CMD ["/doccano/tools/run.sh"]