|
|
@@ -1,29 +1,22 @@
|
|
|
-# Use an official Python runtime as a parent image
|
|
|
-FROM python:3.9-slim
|
|
|
+FROM --platform=$TARGETPLATFORM python:3.11-slim-bookworm
|
|
|
|
|
|
-# Set the working directory in the container
|
|
|
-WORKDIR /app
|
|
|
+# Faster, repeatable builds
|
|
|
+ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
|
+ PYTHONUNBUFFERED=1 \
|
|
|
+ PIP_NO_CACHE_DIR=1 \
|
|
|
+ PIP_DISABLE_PIP_VERSION_CHECK=1
|
|
|
|
|
|
-# Copy the current directory contents into the container at /app
|
|
|
-COPY . /app
|
|
|
+WORKDIR /app
|
|
|
|
|
|
-# Install required system packages
|
|
|
+COPY requirements.txt ./
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
- gcc \
|
|
|
- avrdude \
|
|
|
- wget \
|
|
|
- unzip \
|
|
|
- git \
|
|
|
+ gcc libjpeg-dev zlib1g-dev git \
|
|
|
+ && pip install --upgrade pip \
|
|
|
+ && pip install --no-cache-dir -r requirements.txt \
|
|
|
+ && apt-get purge -y gcc \
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
-# Install any needed packages specified in requirements.txt
|
|
|
-RUN pip install --no-cache-dir -r requirements.txt
|
|
|
+COPY . .
|
|
|
|
|
|
-# Expose the port the app runs on
|
|
|
EXPOSE 8080
|
|
|
-
|
|
|
-# Define environment variable
|
|
|
-ENV FLASK_ENV=development
|
|
|
-
|
|
|
-# Run the command to start the app
|
|
|
-CMD ["python", "app.py"]
|
|
|
+CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8080"]
|