taigaio-taiga-docker
SUCCESS
14m 13s
History Source
SummaryIterations1Transcript21Dockerfile
Dockerfile33 lines · 1121 chars
FROM python:3.11-alpine

# Install system build dependencies required for many Python packages
RUN apk add --no-cache build-base postgresql-dev libjpeg-turbo-dev zlib-dev libffi-dev openssl-dev curl

# Create and set working directory for the application
WORKDIR /app

# Copy the repository contents
COPY . .

# Improve Python packaging tooling
RUN python -m pip install --upgrade pip

# Install Python dependencies if a requirements.txt exists
RUN if [ -f requirements.txt ]; then \
      pip install --no-cache-dir -r requirements.txt; \
    fi

# If there is a setup.py, install the package from source
RUN if [ -f setup.py ]; then \
      python setup.py install; \
    fi

# Start script to serve static content via Python http.server on port 8000
RUN printf '#!/bin/sh\nset -e\nif [ -f manage.py ]; then\n  python manage.py runserver 0.0.0.0:8000 &\nelse\n  python -m http.server 8000 --bind 0.0.0.0 &\nfi\nsleep 1\nwhile true; do sleep 1; done\n' > /start.sh && chmod +x /start.sh

# Expose the common Taiga backend port
EXPOSE 8000

# Default command: start appropriate server or static content
CMD ["/start.sh"]