39 lines
768 B
Docker
39 lines
768 B
Docker
FROM python:3.11-slim
|
|
|
|
# Install gosu for user switching
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends gosu && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
# Install Python dependencies
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy application files
|
|
COPY . .
|
|
|
|
# Create default directories
|
|
RUN mkdir -p /app/data /home/sgo
|
|
|
|
# Copy entrypoint script
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
# Expose port
|
|
EXPOSE 5000
|
|
|
|
# Set environment variables
|
|
ENV FLASK_APP=app.py \
|
|
PYTHONUNBUFFERED=1 \
|
|
PUID=1000 \
|
|
PGID=1000 \
|
|
DEBUG=false \
|
|
HOME=/home/sgo
|
|
|
|
# Use entrypoint for PUID/PGID handling
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
|
|
# Run the application
|
|
CMD ["python", "app.py"]
|