From e2bd322814ab4a01ab9fddaf1eb86020105d05b5 Mon Sep 17 00:00:00 2001 From: Sebarocks Date: Thu, 31 Jul 2025 21:51:38 -0400 Subject: [PATCH] fix dockerfile --- Dockerfile | 55 ++++++++++++++++-------------------------------------- 1 file changed, 16 insertions(+), 39 deletions(-) diff --git a/Dockerfile b/Dockerfile index da1e347..c2f2f1d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,23 @@ -# Multi-stage build for chatsbt application -FROM denoland/deno:alpine AS frontend-builder +# Multi-stage build for a Python backend with Deno frontend -# Set working directory for frontend build +# Stage 1: Build the frontend +FROM denoland/deno:2.4.3 AS frontend-builder + +# Set working directory for frontend WORKDIR /app/frontend -# Copy frontend package files -COPY frontend/package.json frontend/deno.lock ./ +# Copy frontend files +COPY frontend/ . -# Install dependencies with script permissions +# Install dependencies and build the frontend RUN deno install --allow-scripts - -# Copy frontend source code -COPY frontend/ ./ - -# Build the frontend RUN deno run build -# Backend stage -FROM python:3.11-slim AS backend-builder +# Stage 2: Setup Python backend with uv +FROM python:3.11-slim AS backend # Install uv -COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ +COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv # Set working directory WORKDIR /app @@ -29,36 +26,16 @@ WORKDIR /app COPY pyproject.toml uv.lock ./ # Install Python dependencies -RUN uv sync --frozen --no-dev +RUN uv sync --frozen # Copy backend source code -COPY app.py chatgraph.py controllers.py ./ +COPY *.py ./ -# Final stage -FROM python:3.11-slim - -# Install uv in final stage -COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ - -# Set working directory -WORKDIR /app - -# Copy backend dependencies and source -#COPY --from=backend-builder /app/.venv ./.venv -COPY --from=backend-builder /app/app.py /app/chatgraph.py /app/controllers.py ./ - -# Copy built frontend +# Copy built frontend from previous stage COPY --from=frontend-builder /app/frontend/dist ./frontend/dist -# Make sure the virtual environment is activated -#ENV PATH="/app/.venv/bin:$PATH" - -# Expose port +# Expose the port (adjust if your app uses a different port) EXPOSE 8000 -# Health check -HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ - CMD python -c "import requests; requests.get('http://localhost:8000/health', timeout=10)" - # Run the application -CMD ["uv", "run", "app.py"] +CMD ["uv", "run", "app.py"] \ No newline at end of file