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.

44 lines
1.2 KiB

  1. ARG PYTHON_VERSION="3.8.12-slim-buster"
  2. FROM python:${PYTHON_VERSION}
  3. CMD ["python3"]
  4. WORKDIR /backend
  5. ENV PYTHONDONTWRITEBYTECODE 1
  6. ENV PYTHONUNBUFFERED 1
  7. RUN groupadd -g 61000 doccano \
  8. && useradd -g 61000 -l -M -s /bin/false -u 61000 doccano
  9. COPY --chown=doccano:doccano backend/pyproject.toml backend/poetry.lock /backend/
  10. # hadolint ignore=DL3013
  11. RUN apt-get update \
  12. && apt-get install -y --no-install-recommends \
  13. netcat=1.* \
  14. libpq-dev=11.* \
  15. unixodbc-dev=2.* \
  16. g++=4:* \
  17. curl \
  18. && pip install --upgrade pip \
  19. && curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - \
  20. && PATH="${PATH}:$HOME/.poetry/bin" \
  21. && poetry config virtualenvs.create false \
  22. && poetry install --no-dev --no-root \
  23. && poetry add psycopg2-binary \
  24. && apt-get clean \
  25. && rm -rf /var/lib/apt/lists/*
  26. COPY --chown=doccano:doccano tools/ /opt/bin/
  27. RUN mkdir -p /backend/staticfiles \
  28. && mkdir -p /backend/client/dist/static \
  29. && mkdir -p /backend/media \
  30. && chown -R doccano:doccano /backend/
  31. COPY --chown=doccano:doccano ./backend/ /backend/
  32. RUN ls /backend
  33. USER doccano:doccano
  34. VOLUME /backend/staticfiles
  35. ENTRYPOINT [ "/opt/bin/prod-django.sh" ]