fixing imports

This commit is contained in:
2025-09-29 06:53:09 -07:00
parent fa524a90cf
commit b5a6f7da21
2 changed files with 15 additions and 42 deletions

View File

@@ -1,59 +1,25 @@
# Multi-stage Dockerfile for FoodPlanner
# Build stage: Install dependencies
FROM python:3.11-slim AS builder
# Install system dependencies for building Python packages
RUN apt-get update && apt-get install -y \
build-essential \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy requirements file
COPY requirements.txt .
# Install Python dependencies into a virtual environment
RUN python -m venv venv && \
. venv/bin/activate && \
pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Final stage: Copy application code and installed dependencies
FROM python:3.11-slim
# Install runtime dependencies (if any needed beyond Python base)
RUN apt-get update && apt-get install -y \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy the virtual environment from the builder stage
COPY --from=builder /app/venv /app/venv
# Activate the virtual environment
ENV PATH="/app/venv/bin:$PATH"
# Create data directory
RUN mkdir -p /app/data
# Copy requirements and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Set working directory to /app for the application
WORKDIR /app
# Create data directory
RUN mkdir -p /app/data
# Set environment variables
ENV DATABASE_PATH=/app/data
ENV DATABASE_URL=sqlite:////app/data/meal_planner.db
# Expose port (as defined in main.py)
# Expose port
EXPOSE 8999
# Run the application with uvicorn - fix host to 0.0.0.0
# Run the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8999"]

7
docker-compose.yml Normal file
View File

@@ -0,0 +1,7 @@
services:
foodtracker:
build: .
ports:
- "8999:8999"
environment:
- DATABASE_URL=sqlite:////app/meal_planner.db