Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
|
3d0aaab8b3 | ||
|
7085a6e00f |
2 changed files with 18 additions and 13 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -1,6 +1,11 @@
|
|||
# Do not know how to use
|
||||
archive/
|
||||
Dockerfile
|
||||
|
||||
/models
|
||||
app.log
|
||||
*.pt
|
||||
.venv/
|
||||
|
||||
# All pycache directories
|
||||
__pycache__/
|
||||
|
|
26
Dockerfile
26
Dockerfile
|
@ -1,20 +1,20 @@
|
|||
# Use the official Python image from the Docker Hub
|
||||
FROM python:3.13-bookworm
|
||||
# Use newer, more secure base image
|
||||
FROM python:3.13-alpine
|
||||
|
||||
# Set the working directory in the container
|
||||
WORKDIR /app
|
||||
# Update system packages first
|
||||
RUN apk update && apk upgrade
|
||||
|
||||
# Copy the requirements file into the container at /app
|
||||
# Install minimal dependencies
|
||||
RUN apk add --no-cache mesa-gl
|
||||
|
||||
# Use specific package versions
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir --upgrade pip && \
|
||||
pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Update apt, install libgl1, and clear apt cache
|
||||
RUN apt update && apt install -y libgl1 && rm -rf /var/lib/apt/lists/*
|
||||
# Run as non-root user
|
||||
RUN adduser -D -s /bin/sh appuser
|
||||
USER appuser
|
||||
|
||||
# Install any dependencies specified in requirements.txt
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy the rest of the application code into the container at /app
|
||||
COPY . .
|
||||
|
||||
# Run the application
|
||||
CMD ["python3", "-m", "fastapi", "run", "--host", "0.0.0.0", "--port", "8000"]
|
Loading…
Add table
Add a link
Reference in a new issue