Some checks failed
Build and Push Docker Image (Gitea) / build-and-push (push) Has been cancelled
- Remove explicit container_name to allow Docker Compose to generate unique names - Remove custom network configuration as default network is sufficient - Add curl installation and healthcheck to Dockerfile for better container monitoring
36 lines
830 B
Docker
36 lines
830 B
Docker
FROM python:3.10-slim
|
|
|
|
WORKDIR /app
|
|
|
|
# Set environment variables
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV FLASK_APP=app.py
|
|
|
|
# Install dependencies
|
|
# Install curl for healthcheck
|
|
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy application code
|
|
COPY . .
|
|
|
|
# Create data directory
|
|
RUN mkdir -p /app/data
|
|
|
|
# Fix line endings for entrypoint script (in case of Windows checkout) and make executable
|
|
RUN sed -i 's/\r$//' entrypoint.sh && \
|
|
chmod +x entrypoint.sh
|
|
|
|
# Expose port (default 5000)
|
|
EXPOSE 5000
|
|
|
|
# Healthcheck
|
|
HEALTHCHECK --interval=30s --timeout=3s \
|
|
CMD curl -f http://localhost:5000/ || exit 1
|
|
|
|
# Use entrypoint script to init db, seed data, and start server
|
|
ENTRYPOINT ["./entrypoint.sh"]
|