- Added requirements file
- Modified server.py a bit
This commit is contained in:
@@ -1,18 +1,37 @@
|
||||
# 1. Start from a base image with Python installed
|
||||
FROM python:3.13.7
|
||||
# Build:
|
||||
# docker build -t myapp .
|
||||
|
||||
# 2. Set the working directory in the container
|
||||
# Run:
|
||||
# docker run -p 8000:8000 myapp
|
||||
|
||||
# Use Python 3.13.7 base image
|
||||
FROM python:3.13.7-slim
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# 3. Copy requirements file and install dependencies
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
# Install dependencies for opentelemetry + ngrok
|
||||
RUN pip install --no-cache-dir \
|
||||
opentelemetry-distro \
|
||||
opentelemetry-instrumentation \
|
||||
opentelemetry-exporter-otlp \
|
||||
pyngrok
|
||||
|
||||
# 4. Copy the rest of your app’s code
|
||||
# Copy project files
|
||||
COPY . .
|
||||
|
||||
# 5. Expose port (optional, for web apps)
|
||||
# Install Python dependencies from requirements.txt
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Download model at build time
|
||||
RUN python downloadModel.py
|
||||
|
||||
# Expose FastAPI/Flask/HTTP server port
|
||||
EXPOSE 8000
|
||||
|
||||
# 6. Default command to run the app
|
||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
# Copy entrypoint script
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
# Default command: run script
|
||||
CMD ["/entrypoint.sh"]
|
||||
|
||||
Reference in New Issue
Block a user