hls1000 commited on
Commit
db11c8f
·
verified ·
1 Parent(s): 1f87ec0

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -99
Dockerfile CHANGED
@@ -1,106 +1,22 @@
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
- ffmpeg \
15
- wget \
16
- procps \
17
- git-lfs \
18
- zip \
19
- unzip \
20
- htop \
21
- vim \
22
- nano \
23
- bzip2 \
24
- libx11-6 \
25
- build-essential \
26
- libsndfile-dev \
27
- software-properties-common \
28
- && rm -rf /var/lib/apt/lists/*
29
-
30
- RUN add-apt-repository ppa:flexiondotorg/nvtop && \
31
- apt-get upgrade -y && \
32
- apt-get install -y --no-install-recommends nvtop
33
-
34
- RUN curl -sL https://deb.nodesource.com/setup_21.x | bash - && \
35
- apt-get install -y nodejs && \
36
- npm install -g configurable-http-proxy
37
-
38
- # Create a working directory
39
- WORKDIR /app
40
-
41
- # Create a non-root user and switch to it
42
- RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
43
- && chown -R user:user /app
44
- RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
45
- USER user
46
-
47
- # All users can use /home/user as their home directory
48
- ENV HOME=/home/user
49
- RUN mkdir $HOME/.cache $HOME/.config \
50
- && chmod -R 777 $HOME
51
-
52
- # Set up the Conda environment
53
- ENV CONDA_AUTO_UPDATE_CONDA=false \
54
- PATH=$HOME/miniconda/bin:$PATH
55
- RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \
56
- && chmod +x ~/miniconda.sh \
57
- && ~/miniconda.sh -b -p ~/miniconda \
58
- && rm ~/miniconda.sh \
59
- && conda clean -ya
60
-
61
- WORKDIR $HOME/app
62
-
63
- #######################################
64
- # Start root user section
65
- #######################################
66
-
67
- USER root
68
-
69
- # User Debian packages
70
- ## Security warning : Potential user code executed as root (build time)
71
- RUN --mount=target=/root/packages.txt,source=packages.txt \
72
- apt-get update && \
73
- xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends \
74
  && rm -rf /var/lib/apt/lists/*
75
 
76
- RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
77
- bash /root/on_startup.sh
78
-
79
- RUN mkdir /data && chown user:user /data
80
-
81
- #######################################
82
- # End root user section
83
- #######################################
84
-
85
- USER user
86
-
87
- # Python packages
88
- RUN --mount=target=requirements.txt,source=requirements.txt \
89
- pip install --no-cache-dir --upgrade -r requirements.txt
90
-
91
- # Copy the current directory contents into the container at $HOME/app setting the owner to the user
92
- COPY --chown=user . $HOME/app
93
-
94
- RUN chmod +x start_server.sh
95
 
96
- COPY --chown=user login.html /home/user/miniconda/lib/python3.9/site-packages/jupyter_server/templates/login.html
 
97
 
98
- ENV PYTHONUNBUFFERED=1 \
99
- GRADIO_ALLOW_FLAGGING=never \
100
- GRADIO_NUM_PORTS=1 \
101
- GRADIO_SERVER_NAME=0.0.0.0 \
102
- GRADIO_THEME=huggingface \
103
- SYSTEM=spaces \
104
- SHELL=/bin/bash
105
 
106
- CMD ["./start_server.sh"]
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
 
3
+ RUN apt-get update && apt-get install -y \
 
 
 
 
 
 
 
 
 
4
  git \
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  && rm -rf /var/lib/apt/lists/*
6
 
7
+ RUN pip install --no-cache-dir jupyterlab jupyter-server
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
+ ENV PORT=7860
10
+ ENV JUPYTER_PASSWORD=changeme
11
 
12
+ WORKDIR /workspace
 
 
 
 
 
 
13
 
14
+ CMD ["sh", "-c", "\
15
+ HASHED_PASSWORD=$(python - << 'EOF'\nfrom jupyter_server.auth import passwd\nimport os\nprint(passwd(os.environ['JUPYTER_PASSWORD']))\nEOF\n) && \
16
+ jupyter lab \
17
+ --ip=0.0.0.0 \
18
+ --port=7860 \
19
+ --no-browser \
20
+ --IdentityProvider.token='' \
21
+ --PasswordIdentityProvider.hashed_password=$HASHED_PASSWORD \
22
+ "]