taigaio-taiga-docker
SUCCESS
23m 01s
History Source
SummaryIterations2Transcript33Dockerfile
Dockerfile56 lines · 1231 chars
FROM python:3.11-alpine3.18

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1

RUN apk add --no-cache \
        bash \
        curl \
        ca-certificates \
        postgresql-dev \
        libffi-dev \
        openssl-dev \
        tzdata \
        build-base

RUN adduser -D app

WORKDIR /app

COPY . /app

RUN chown -R app:app /app

USER root

RUN python -m ensurepip --upgrade
RUN python -m pip install --upgrade pip wheel setuptools

RUN if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
RUN if [ -f setup.py ]; then python setup.py install; fi

RUN mkdir -p /entrypoint_dir
RUN cat > /entrypoint.sh << 'EOS'
#!/bin/sh
set -e
if [ -f manage.py ]; then
  if command -v gunicorn >/dev/null 2>&1; then
    exec gunicorn taiga_back.wsgi:application --bind 0.0.0.0:8000
  else
    exec python manage.py runserver 0.0.0.0:8000
  fi
else
  echo 'No manage.py found; starting a simple HTTP server for smoke tests'
  exec python -m http.server 8000 --bind 0.0.0.0
fi
EOS
RUN chmod +x /entrypoint.sh

EXPOSE 8000

USER app

HEALTHCHECK --interval=15s --timeout=5s --start-period=10s --retries=3 CMD curl -fsS http://localhost:8000/health || curl -fsS http://localhost:8000/ || exit 1

CMD ["/entrypoint.sh"]