Update Dockerfile
Browse files- Dockerfile +9 -29
Dockerfile
CHANGED
|
@@ -1,40 +1,20 @@
|
|
| 1 |
# Use an official Python runtime as a parent image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
-
# Set working directory in container
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
RUN apt-get update && apt-get install -y \
|
| 9 |
-
libtk8.6 \
|
| 10 |
-
libnss3 \
|
| 11 |
-
libxss1 \
|
| 12 |
-
libasound2 \
|
| 13 |
-
libx11-xcb1 \
|
| 14 |
-
libxcomposite1 \
|
| 15 |
-
libxcursor1 \
|
| 16 |
-
libxdamage1 \
|
| 17 |
-
libxi6 \
|
| 18 |
-
libxtst6 \
|
| 19 |
-
libappindicator1 \
|
| 20 |
-
libxrandr2 \
|
| 21 |
-
librsvg2-common\
|
| 22 |
-
gvfs-common\
|
| 23 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 24 |
-
|
| 25 |
-
# Install Python dependencies
|
| 26 |
-
RUN python -m venv venv
|
| 27 |
-
ENV PATH="/app/venv/bin:$PATH"
|
| 28 |
-
RUN pip install --upgrade pip
|
| 29 |
-
|
| 30 |
COPY requirements.txt .
|
| 31 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 32 |
|
| 33 |
-
#
|
|
|
|
|
|
|
|
|
|
| 34 |
COPY . .
|
| 35 |
|
| 36 |
-
# Expose port 8000 for
|
| 37 |
EXPOSE 8000
|
| 38 |
|
| 39 |
-
# Run command when container launches
|
| 40 |
-
CMD ["
|
|
|
|
| 1 |
# Use an official Python runtime as a parent image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
+
# Set the working directory in the container
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Copy the requirements file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
COPY requirements.txt .
|
|
|
|
| 9 |
|
| 10 |
+
# Install the dependencies with --upgrade-pip flag
|
| 11 |
+
RUN python -m pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
|
| 12 |
+
|
| 13 |
+
# Copy the application code into current directory
|
| 14 |
COPY . .
|
| 15 |
|
| 16 |
+
# Expose port 8000 for FastAPI app
|
| 17 |
EXPOSE 8000
|
| 18 |
|
| 19 |
+
# Run command when container launches with uvicorn
|
| 20 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|