LarryHopeCodeL
Convex Community2y ago
9 replies
LarryHopeCode

Any document or tips to deploy convex production environment to Google Cloud Run or any other docker

Trying to use Convex and Python Fastapi together in docker container, here is the Dockerfile.
FROM python:3.12.2-slim-bullseye as runner 

COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=builder /app /app

WORKDIR /app

# Install Node.js and npm in the runner stage
RUN apt-get update && \
    apt-get install -y nodejs npm && \
    rm -rf /var/lib/apt/lists/*

# Set Convex deploy key environment variable
ENV CONVEX_DEPLOY_KEY="xxxxxxxx"

# Deploy your Convex project before starting the FastAPI application
RUN npx convex deploy -y

# Set the correct entrypoint for the FastAPI application
ENTRYPOINT ["python"]
CMD ["-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]

And this python program work with Convex in Dev environment very well.
Was this page helpful?