Files
calorie_tracker/calorie_tracker_app/Dockerfile
Jp 1dcb871114
Some checks failed
Build and Push Docker Image (Gitea) / build-and-push (push) Has been cancelled
fix(docker): correct port mapping and improve container startup
- Fix port mapping from 5001:5001 to 5001:5000 to match internal application port
- Add entrypoint script for proper database initialization and seeding
- Set PORT environment variable to 5000 for consistency
- Update Dockerfile to use entrypoint script with proper line ending handling
2026-01-30 22:24:17 +08:00

29 lines
617 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
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
# Use entrypoint script to init db, seed data, and start server
ENTRYPOINT ["./entrypoint.sh"]