Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
Pongsatorn
3d0aaab8b3 update Docker File to low vulnerabilities 2025-07-13 15:06:03 +07:00
Pongsatorn
7085a6e00f update gitignore .venv 2025-07-13 13:25:36 +07:00
2 changed files with 18 additions and 13 deletions

5
.gitignore vendored
View file

@ -1,6 +1,11 @@
# Do not know how to use
archive/
Dockerfile
/models
app.log
*.pt
.venv/
# All pycache directories
__pycache__/

View file

@ -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"]