abdoolamunir's picture
Create Dockerfile
3c078e3 verified
raw
history blame
791 Bytes
# Use an official Python runtime as a parent image
FROM python:3.8-slim
# Set the working directory in the container
WORKDIR /app
# Copy only the files needed for pip install first to leverage Docker caching
COPY requirements.txt ./
# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Install PyTorch
RUN pip install torch torchvision torchaudio -f https://download.pytorch.org/whl/torch_stable.html
# Copy the rest of your application's source code from your host to your image filesystem
COPY . /app
# Make port 8000 available to the world outside this container
EXPOSE 8000
# Define environment variable
ENV NAME World
# Command to run the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]