Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +16 -7
Dockerfile
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Copy the package list and requirements file to the container
|
| 2 |
COPY packages.txt requirements.txt /root/
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
sed -i '/security/d' /etc/apt/sources.list && \
|
| 7 |
apt-get update && \
|
| 8 |
xargs -r -a /root/packages.txt apt-get install -y && \
|
|
@@ -10,15 +19,15 @@ RUN sed -i 's/http:\/\/deb.debian.org/http:\/\/cdn-aws.deb.debian.org/g' /etc/ap
|
|
| 10 |
|
| 11 |
# Install Python and the packages listed in requirements.txt
|
| 12 |
RUN apt-get update && \
|
| 13 |
-
RUN apt-get update && \
|
| 14 |
DEBIAN_FRONTEND=noninteractive apt-get install -y python3 python3-pip && \
|
|
|
|
| 15 |
pip3 install --no-cache-dir datasets==1.14.0 huggingface-hub==0.12.1
|
| 16 |
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
docker build -t my-image-name --mount=type=bind,source="$(pwd)"/packages.txt,target=/root/packages.txt -f Dockerfile
|
| 22 |
|
| 23 |
|
| 24 |
|
|
|
|
| 1 |
+
# Dockerfile
|
| 2 |
+
FROM python:3.8.9
|
| 3 |
+
|
| 4 |
+
WORKDIR /app
|
| 5 |
+
|
| 6 |
# Copy the package list and requirements file to the container
|
| 7 |
COPY packages.txt requirements.txt /root/
|
| 8 |
|
| 9 |
+
# Add a mount point for the package list
|
| 10 |
+
VOLUME /packages
|
| 11 |
+
|
| 12 |
+
# Update package sources and install packages from the list
|
| 13 |
+
RUN sed -i 's http://deb.debian.org http://cdn-aws.deb.debian.org g' /etc/apt/sources.list && \
|
| 14 |
+
sed -i 's http://archive.ubuntu.com http://us-east-1.ec2.archive.ubuntu.com g' /etc/apt/sources.list && \
|
| 15 |
sed -i '/security/d' /etc/apt/sources.list && \
|
| 16 |
apt-get update && \
|
| 17 |
xargs -r -a /root/packages.txt apt-get install -y && \
|
|
|
|
| 19 |
|
| 20 |
# Install Python and the packages listed in requirements.txt
|
| 21 |
RUN apt-get update && \
|
|
|
|
| 22 |
DEBIAN_FRONTEND=noninteractive apt-get install -y python3 python3-pip && \
|
| 23 |
+
pip3 install --no-cache-dir -r /app/requirements.txt && \
|
| 24 |
pip3 install --no-cache-dir datasets==1.14.0 huggingface-hub==0.12.1
|
| 25 |
|
| 26 |
+
# Copy the source code to the container
|
| 27 |
+
COPY . /app
|
| 28 |
|
| 29 |
+
# Set the default command
|
| 30 |
+
CMD ["python", "app.py"]
|
|
|
|
|
|
|
| 31 |
|
| 32 |
|
| 33 |
|