rahulreshma commited on
Commit
4a25409
·
verified ·
1 Parent(s): 1cb650b

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +94 -0
Dockerfile ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM nvidia/cuda:12.5.1-cudnn-devel-ubuntu20.04
2
+
3
+ ENV DEBIAN_FRONTEND=noninteractive \
4
+ TZ=Europe/Paris
5
+
6
+ # Remove any third-party apt sources to avoid issues with expiring keys.
7
+ # Install some basic utilities
8
+ RUN rm -f /etc/apt/sources.list.d/*.list && \
9
+ apt-get update && apt-get install -y --no-install-recommends \
10
+ curl \
11
+ ca-certificates \
12
+ sudo \
13
+ git \
14
+ wget \
15
+ htop \
16
+ && rm -rf /var/lib/apt/lists/*
17
+
18
+ #RUN add-apt-repository ppa:flexiondotorg/nvtop && \
19
+ # apt-get upgrade -y && \
20
+ # apt-get install -y --no-install-recommends nvtop
21
+
22
+ #RUN curl -sL https://deb.nodesource.com/setup_21.x | bash - && \
23
+ # apt-get install -y nodejs && \
24
+ # npm install -g configurable-http-proxy
25
+
26
+ # Create a working directory
27
+ WORKDIR /app
28
+
29
+ # Create a non-root user and switch to it
30
+ RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
31
+ && chown -R user:user /app
32
+ RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
33
+ USER user
34
+
35
+ # All users can use /home/user as their home directory
36
+ ENV HOME=/home/user
37
+ RUN mkdir $HOME/.cache $HOME/.config \
38
+ && chmod -R 777 $HOME
39
+
40
+ # Set up the Conda environment
41
+ #ENV CONDA_AUTO_UPDATE_CONDA=false \
42
+ # PATH=$HOME/miniconda/bin:$PATH
43
+ #RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \
44
+ # && chmod +x ~/miniconda.sh \
45
+ # && ~/miniconda.sh -b -p ~/miniconda \
46
+ # && rm ~/miniconda.sh \
47
+ # && conda clean -ya
48
+
49
+ WORKDIR $HOME/app
50
+
51
+ #######################################
52
+ # Start root user section
53
+ #######################################
54
+
55
+ USER root
56
+
57
+ # User Debian packages
58
+ ## Security warning : Potential user code executed as root (build time)
59
+ RUN --mount=target=/root/packages.txt,source=packages.txt \
60
+ apt-get update && \
61
+ xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends \
62
+ && rm -rf /var/lib/apt/lists/*
63
+
64
+ RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
65
+ bash /root/on_startup.sh
66
+
67
+ RUN mkdir /data && chown user:user /data
68
+
69
+ #######################################
70
+ # End root user section
71
+ #######################################
72
+
73
+ USER root
74
+
75
+ # Python packages
76
+ RUN --mount=target=requirements.txt,source=requirements.txt \
77
+ pip install --no-cache-dir --upgrade -r requirements.txt
78
+
79
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
80
+ COPY --chown=user . $HOME/app
81
+
82
+ RUN chmod +x start.sh
83
+
84
+ #COPY --chown=user login.html /home/user/miniconda/lib/python3.9/site-packages/jupyter_server/templates/login.html
85
+
86
+ ENV PYTHONUNBUFFERED=1 \
87
+ GRADIO_ALLOW_FLAGGING=never \
88
+ GRADIO_NUM_PORTS=1 \
89
+ GRADIO_SERVER_NAME=0.0.0.0 \
90
+ GRADIO_THEME=huggingface \
91
+ SYSTEM=spaces \
92
+ SHELL=/bin/bash
93
+
94
+ CMD ["./start.sh"]