LarryHopeCode
LarryHopeCode
CCConvex Community
Created by LarryHopeCode on 4/14/2024 in #support-community
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"]
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.
10 replies
CCConvex Community
Created by LarryHopeCode on 3/6/2024 in #support-community
Deploy dev or preview to Vercel.
Love this new concept product and want to port current project wit h MongoDB and Prisma to it. Deploy to Vercel. Test production deployment seems ok and we need to change package.json's build command to include npx convex deploy. But we can not do it when we use dev or preview environment. Convex will link us to production URL. But if we remove convex deploy in command line, Vercel won't be even successfully compiled. Check all over document, no clear answer. Any good idea?
38 replies