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.

46 lines
1.3 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. SHELL ["/bin/bash", "-o", "pipefail", "-c"]
  11. # hadolint ignore=DL3013,DL3008
  12. RUN apt-get update \
  13. && apt-get install -y --no-install-recommends \
  14. netcat=1.* \
  15. libpq-dev=11.* \
  16. unixodbc-dev=2.* \
  17. g++=4:* \
  18. curl \
  19. && pip install --upgrade --no-cache-dir pip \
  20. && curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - \
  21. && PATH="${PATH}:$HOME/.poetry/bin" \
  22. && poetry config virtualenvs.create false \
  23. && poetry install --no-dev --no-root \
  24. && poetry add psycopg2-binary \
  25. && apt-get clean \
  26. && rm -rf /var/lib/apt/lists/*
  27. COPY --chown=doccano:doccano tools/ /opt/bin/
  28. RUN mkdir -p /backend/staticfiles \
  29. && mkdir -p /backend/client/dist/static \
  30. && mkdir -p /backend/media \
  31. && mkdir -p /backend/filepond-temp-uploads \
  32. && chown -R doccano:doccano /backend/
  33. COPY --chown=doccano:doccano ./backend/ /backend/
  34. RUN ls /backend
  35. USER doccano:doccano
  36. VOLUME /backend/staticfiles
  37. ENTRYPOINT [ "/opt/bin/prod-django.sh" ]