Update Dockerfile
Browse files- Dockerfile +17 -10
Dockerfile
CHANGED
|
@@ -1,21 +1,28 @@
|
|
| 1 |
# Use an official Python runtime as a parent image
|
| 2 |
-
FROM python:3.
|
| 3 |
|
| 4 |
# Set the working directory in the container
|
| 5 |
-
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Copy the current directory contents into the container at /app
|
| 8 |
-
COPY . /app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
# Install any needed packages specified in requirements.txt
|
| 11 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
|
| 13 |
-
#
|
| 14 |
-
EXPOSE 7860
|
| 15 |
-
|
| 16 |
-
# Define environment variable
|
| 17 |
ARG ACC_TOKEN
|
| 18 |
ENV AccToken=${ACC_TOKEN}
|
| 19 |
|
| 20 |
-
#
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Use an official Python runtime as a parent image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
|
| 4 |
# Set the working directory in the container
|
| 5 |
+
WORKDIR /home/user/app
|
| 6 |
|
| 7 |
+
# Copy the current directory contents into the container at /home/user/app
|
| 8 |
+
COPY . /home/user/app
|
| 9 |
+
|
| 10 |
+
# Install necessary system dependencies
|
| 11 |
+
RUN apt-get update && apt-get install -y \
|
| 12 |
+
build-essential \
|
| 13 |
+
libgl1-mesa-glx \
|
| 14 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
# Install any needed packages specified in requirements.txt
|
| 17 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 18 |
|
| 19 |
+
# Set the environment variable for Hugging Face access token
|
|
|
|
|
|
|
|
|
|
| 20 |
ARG ACC_TOKEN
|
| 21 |
ENV AccToken=${ACC_TOKEN}
|
| 22 |
|
| 23 |
+
# Expose the port the app runs on
|
| 24 |
+
EXPOSE 7860
|
| 25 |
+
|
| 26 |
+
# Define the command to run the application
|
| 27 |
+
CMD ["python", "app.py"]
|
| 28 |
+
RUN docker run -p 7860:7860 --env ACC_TOKEN=your_huggingface_token --cpus="32" --memory="200g" --gpus '"device=0,1,2,3,4,5,6,7,8,9"' your-image-name
|