Spaces:
Paused
Paused
| # Build stage for Go application | |
| FROM golang:1.23.3-bookworm AS builder | |
| WORKDIR /app | |
| # Copy go.mod and go.sum for shared and server | |
| COPY ./app/shared/go.mod ./app/shared/go.sum ./shared/ | |
| RUN cd shared && go mod download | |
| COPY ./app/server/go.mod ./app/server/go.sum ./server/ | |
| RUN cd server && go mod download | |
| # Copy the actual source code | |
| COPY ./app/server ./server | |
| COPY ./app/shared ./shared | |
| # Build the application | |
| WORKDIR /app/server | |
| RUN go build -o plandex-server . | |
| # Final stage | |
| FROM python:3.11-slim-bookworm | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| gcc \ | |
| g++ \ | |
| make \ | |
| curl \ | |
| postgresql \ | |
| postgresql-contrib \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install uv | |
| COPY --from=ghcr.io/astral-sh/uv:latest /uv /uv/bin/uv | |
| ENV PATH="/uv/bin:${PATH}" | |
| # Create a non-root user | |
| RUN useradd -m -u 1000 plandex | |
| # Set up working directory | |
| WORKDIR /app/server | |
| # Copy built application and essential files | |
| COPY --from=builder /app/server/plandex-server . | |
| COPY --from=builder /app/server/version.txt . | |
| COPY --from=builder /app/server/litellm_proxy.py . | |
| COPY --from=builder /app/server/migrations ./migrations | |
| # Install Python dependencies using uv | |
| RUN uv pip install --system \ | |
| "litellm==1.72.6" \ | |
| "fastapi==0.115.12" \ | |
| "uvicorn==0.34.1" \ | |
| "google-cloud-aiplatform==1.96.0" \ | |
| "boto3==1.38.40" \ | |
| "botocore==1.38.40" | |
| # Set up Postgres data directory and permissions | |
| RUN mkdir -p /var/lib/postgresql/data && \ | |
| mkdir -p /run/postgresql && \ | |
| chown -R plandex:plandex /var/lib/postgresql /app /run/postgresql | |
| # Switch to non-root user | |
| USER plandex | |
| # Environment variables | |
| ENV PORT=7860 | |
| ENV GOENV=development | |
| ENV LOCAL_MODE=1 | |
| ENV DATABASE_URL=postgres://plandex:plandex@localhost:5432/plandex?sslmode=disable | |
| ENV PLANDEX_BASE_DIR=/app/server/data | |
| ENV MIGRATIONS_DIR=/app/server/migrations | |
| ENV PATH="/usr/lib/postgresql/15/bin:${PATH}" | |
| RUN mkdir -p $PLANDEX_BASE_DIR | |
| # Expose port | |
| EXPOSE 7860 | |
| # Copy entrypoint script | |
| COPY --chown=plandex:plandex entrypoint.sh . | |
| RUN chmod +x entrypoint.sh | |
| CMD ["./entrypoint.sh"] | |