mirror of
https://github.com/sstent/foodplanner.git
synced 2026-01-25 03:01:35 +00:00
fixing imports
This commit is contained in:
50
Dockerfile
50
Dockerfile
@@ -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
|
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
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy the virtual environment from the builder stage
|
# Copy requirements and install dependencies
|
||||||
COPY --from=builder /app/venv /app/venv
|
COPY requirements.txt .
|
||||||
|
RUN pip install --no-cache-dir --upgrade pip && \
|
||||||
# Activate the virtual environment
|
pip install --no-cache-dir -r requirements.txt
|
||||||
ENV PATH="/app/venv/bin:$PATH"
|
|
||||||
|
|
||||||
# Create data directory
|
|
||||||
RUN mkdir -p /app/data
|
|
||||||
|
|
||||||
# Copy application code
|
# Copy application code
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Set working directory to /app for the application
|
# Create data directory
|
||||||
WORKDIR /app
|
RUN mkdir -p /app/data
|
||||||
|
|
||||||
# Set environment variables
|
# Set environment variables
|
||||||
ENV DATABASE_PATH=/app/data
|
ENV DATABASE_PATH=/app/data
|
||||||
ENV DATABASE_URL=sqlite:////app/data/meal_planner.db
|
ENV DATABASE_URL=sqlite:////app/data/meal_planner.db
|
||||||
|
|
||||||
|
# Expose port
|
||||||
# Expose port (as defined in main.py)
|
|
||||||
EXPOSE 8999
|
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"]
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8999"]
|
||||||
7
docker-compose.yml
Normal file
7
docker-compose.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
services:
|
||||||
|
foodtracker:
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- "8999:8999"
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=sqlite:////app/meal_planner.db
|
||||||
Reference in New Issue
Block a user