-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
30 lines (23 loc) · 981 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Example: https://github.com/GoogleCloudPlatform/cloud-run-microservice-template-python/blob/main/Dockerfile
# Use the official lightweight Python image.
# https://hub.docker.com/_/python
FROM python:3.12.7-slim as base
# Allow statements and log messages to immediately appear in the Cloud Run logs
ENV PYTHONUNBUFFERED=1
ENV UV_COMPILE_BYTECODE=1
ENV UV_LINK_MODE=copy
# uv installation
COPY --from=ghcr.io/astral-sh/uv:0.5.4 /uv /uvx /bin/
# Ensure the installed binary is on the `PATH`
ENV PATH="/root/.local/bin/:$PATH"
# Copy local code to the container image.
ADD . /quantist_api
# Create and change to the app directory.
WORKDIR /quantist_api
# Sync the project into a new environment, using the frozen lockfile
RUN uv sync --compile-bytecode
# Clean up
RUN apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
# Run the web service on container startup.
CMD ["uv", "run", "fastapi", "run", "main.py", "--host", "0.0.0.0", "--port", "8000", "--workers", "4"]