nqtruong commited on
Commit
0c45a36
·
verified ·
1 Parent(s): a769dea

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +41 -0
Dockerfile ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
+ # you will also find guides on how best to write your Dockerfile
3
+
4
+ FROM python:latest
5
+
6
+ RUN apt-get update \
7
+ && apt-get install unzip \
8
+ && apt install pv
9
+
10
+ WORKDIR /code
11
+
12
+ COPY ./requirements.txt /code/requirements.txt
13
+
14
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
15
+
16
+ # Set up a new user named "user" with user ID 1000
17
+ RUN useradd -m -u 1000 user
18
+
19
+ # Switch to the "user" user
20
+ USER user
21
+
22
+ # Set home to the user's home directory
23
+ ENV HOME=/home/user \
24
+ PATH=/home/user/.local/bin:$PATH
25
+
26
+ # Set the working directory to the user's home directory
27
+ WORKDIR $HOME/app
28
+
29
+ # Try and run pip command after setting the user with `USER user` to avoid permission issues with Python
30
+ RUN pip install --no-cache-dir --upgrade pip
31
+ # RUN pip install gdown tqdm
32
+ # RUN gdown --id 0B7EVK8r0v71pZjFTYXZWM3FlRnM
33
+
34
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
35
+ COPY --chown=user . $HOME/app
36
+
37
+ # RUN n_files=`unzip -l image_align_celeba.zip | tail -n 1 | xargs echo -n | cut -d' ' -f2`
38
+ # RUN unzip -oq img_align_celeba.zip | tqdm --desc extracted --unit files --unit_scale --total $n_files > /dev/null
39
+ RUN unzip -q img_align_celeba.zip
40
+
41
+ CMD ["python", "app.py", "--port", "7860"]