Crystalcareai commited on
Commit
f45e326
1 Parent(s): f3e3888

Upload Dockerfile.dockerfile

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