generated from guardrails-ai/validator-template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
35 lines (25 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
31
32
33
34
35
# Use an official PyTorch image with CUDA support
FROM pytorch/pytorch:1.13.1-cuda11.6-cudnn8-runtime
# Set the working directory
WORKDIR /app
# Copy the pyproject.toml and any other necessary files (e.g., README, LICENSE)
COPY pyproject.toml .
COPY README.md .
COPY LICENSE .
# Install dependencies from the pyproject.toml file
RUN pip install --upgrade pip setuptools wheel
RUN pip install .
# Install the necessary packages for the FastAPI app, including CuPy with CUDA 11.6
RUN pip install fastapi "uvicorn[standard]" gunicorn "spacy[cuda116]"
# Copy the entire project code into the container
COPY . /app
# Copy the serve script into the container
COPY serve /usr/local/bin/serve
# Make the serve script executable
RUN chmod +x /usr/local/bin/serve
# Set environment variable to determine the device (cuda or cpu)
ENV env=prod
# Expose the port that the FastAPI app will run on
EXPOSE 8080
# Set the entrypoint for SageMaker to the serve script
ENTRYPOINT ["serve"]