initial commit
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
# Use an official Python runtime as a parent image
|
||||
FROM python:3.11-alpine
|
||||
|
||||
# Set environment variables
|
||||
# Prevents Python from writing pyc files to disc
|
||||
ENV PYTHONDONTWRITEBYTECODE 1
|
||||
# Prevents Python from buffering stdout and stderr
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
|
||||
# Install uv (a fast Python package installer)
|
||||
RUN pip install uv
|
||||
|
||||
# Set the working directory in the container
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the dependencies file to the working directory
|
||||
ADD uv.lock pyproject.toml /app/
|
||||
|
||||
# Install any needed packages specified in requirements.txt using uv
|
||||
# --no-cache ensures that we don't store the download cache, keeping the image smaller
|
||||
RUN uv sync --no-cache
|
||||
|
||||
# Copy the content of the local src directory to the working directory
|
||||
# Assuming your main.py is in the same directory as the Dockerfile
|
||||
COPY main.py .
|
||||
|
||||
# Make port 8000 available to the world outside this container
|
||||
EXPOSE 8000
|
||||
|
||||
# Define environment variable for the Uvicorn server (optional, can be overridden)
|
||||
ENV MODULE_NAME="main:app"
|
||||
ENV VARIABLE_NAME="app"
|
||||
ENV APP_MODULE="main:app"
|
||||
|
||||
# Run app.py when the container launches
|
||||
CMD ["uv" ,"run", "python", "main.py"]
|
||||
Reference in New Issue
Block a user