PYAE1994 commited on
Commit
00692df
·
verified ·
1 Parent(s): 7f1fac3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +149 -72
Dockerfile CHANGED
@@ -6,98 +6,175 @@ ENV DEBIAN_FRONTEND=noninteractive \
6
  LC_ALL=C.UTF-8 \
7
  PYTHONUNBUFFERED=1
8
 
9
- # ========================
10
- # Base deps
11
- # ========================
12
- RUN apt-get update && apt-get install -y \
13
- curl git git-lfs wget unzip zip \
14
- build-essential sudo nginx vim \
15
- jq net-tools ca-certificates \
16
- python3 python3-pip \
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  && rm -rf /var/lib/apt/lists/*
18
 
19
- # ========================
20
- # OpenVSCode (stable pinned)
21
- # ========================
22
- ARG VSCODE_VERSION=1.99.0
23
-
24
- RUN mkdir -p /app/openvscode-server && \
25
- curl -L -o /tmp/openvscode.tar.gz \
26
- https://github.com/gitpod-io/openvscode-server/releases/download/openvscode-server-v${VSCODE_VERSION}/openvscode-server-v${VSCODE_VERSION}-linux-x64.tar.gz && \
27
- tar -xzf /tmp/openvscode.tar.gz -C /app/openvscode-server --strip-components=1 && \
28
- rm -f /tmp/openvscode.tar.gz
29
-
30
- # ========================
31
- # Node.js tools
32
- # ========================
33
- RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  apt-get install -y nodejs && \
35
- npm install -g configurable-http-proxy tsx tslab http-server miniflare@2
 
 
 
 
 
36
 
37
- # ========================
38
- # User
39
- # ========================
40
- RUN useradd -m user && \
41
- mkdir -p /home/user/app && \
42
- chown -R user:user /home/user
 
 
 
 
 
43
 
44
  ENV HOME=/home/user
45
- ENV PATH=$HOME/miniconda/bin:$PATH
46
- ENV PYTHONPATH=/home/user/app
47
 
48
- WORKDIR /home/user/app
 
49
 
50
- # ========================
51
  # Miniconda
52
- # ========================
53
- RUN curl -sLo ~/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py310_23.5.2-0-Linux-x86_64.sh && \
 
 
 
 
 
54
  chmod +x ~/miniconda.sh && \
55
  ~/miniconda.sh -b -p ~/miniconda && \
56
- rm ~/miniconda.sh
 
57
 
58
- # ========================
59
- # Copy ALL config files FIRST (IMPORTANT FIX)
60
- # ========================
61
- COPY packages.txt /root/packages.txt
62
- COPY on_startup.sh /root/on_startup.sh
63
 
 
 
 
64
  USER root
65
 
66
- RUN apt-get update && \
67
- if [ -f /root/packages.txt ]; then \
68
- xargs -r -a /root/packages.txt apt-get install -y; \
69
- fi && \
70
- if [ -f /root/on_startup.sh ]; then \
71
- bash /root/on_startup.sh || true; \
72
- fi
73
-
74
- # ========================
75
- # Python deps
76
- # ========================
77
- USER user
78
 
79
- COPY requirements.txt /home/user/app/
80
- RUN pip install --no-cache-dir -r requirements.txt
 
81
 
82
- # ========================
83
- # App source (CRITICAL FIX)
84
- # ========================
85
- COPY --chown=user . /home/user/app
86
 
87
- # ========================
88
- # Agent layer safety check
89
- # ========================
90
- RUN test -d /home/user/app/agent || mkdir -p /home/user/app/agent
91
 
92
- # ========================
93
- # Playwright (optional)
94
- # ========================
95
- RUN pip install playwright && playwright install --with-deps || true
96
 
97
- # ========================
98
- # Permissions (FIXED ORDER)
99
- # ========================
100
- RUN chmod +x /home/user/app/start_server.sh || true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
 
102
  EXPOSE 7860 3000
103
 
 
6
  LC_ALL=C.UTF-8 \
7
  PYTHONUNBUFFERED=1
8
 
9
+ # =====================================================
10
+ # Base system dependencies
11
+ # =====================================================
12
+ RUN rm -f /etc/apt/sources.list.d/*.list && \
13
+ apt-get update && apt-get install -y \
14
+ curl \
15
+ ca-certificates \
16
+ sudo \
17
+ git \
18
+ git-lfs \
19
+ zip \
20
+ unzip \
21
+ wget \
22
+ nginx \
23
+ vim \
24
+ jq \
25
+ net-tools \
26
+ lsof \
27
+ telnet \
28
+ htop \
29
+ bzip2 \
30
+ build-essential \
31
+ software-properties-common \
32
+ python3 \
33
+ python3-pip \
34
+ libx11-6 \
35
+ libsndfile-dev \
36
  && rm -rf /var/lib/apt/lists/*
37
 
38
+ # =====================================================
39
+ # OpenVSCode Server
40
+ # =====================================================
41
+ ARG BUILD_DATE
42
+ ARG VERSION
43
+ ARG CODE_RELEASE
44
+
45
+ RUN \
46
+ echo "**** install openvscode-server runtime dependencies ****" && \
47
+ apt-get update && \
48
+ apt-get install -y \
49
+ libatomic1 \
50
+ nano \
51
+ netcat && \
52
+ echo "**** install openvscode-server ****" && \
53
+ if [ -z ${CODE_RELEASE+x} ]; then \
54
+ CODE_RELEASE=$(curl -sX GET "https://api.github.com/repos/gitpod-io/openvscode-server/releases/latest" \
55
+ | awk '/tag_name/{print $4;exit}' FS='[""]' \
56
+ | sed 's|^openvscode-server-v||'); \
57
+ fi && \
58
+ mkdir -p /app/openvscode-server && \
59
+ curl -o /tmp/openvscode-server.tar.gz -L \
60
+ "https://github.com/gitpod-io/openvscode-server/releases/download/openvscode-server-v${CODE_RELEASE}/openvscode-server-v${CODE_RELEASE}-linux-x64.tar.gz" && \
61
+ tar xf /tmp/openvscode-server.tar.gz \
62
+ -C /app/openvscode-server/ \
63
+ --strip-components=1 && \
64
+ apt-get clean && \
65
+ rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/*
66
+
67
+ # =====================================================
68
+ # Optional nvtop
69
+ # =====================================================
70
+ RUN add-apt-repository ppa:flexiondotorg/nvtop && \
71
+ apt-get update && \
72
+ apt-get install -y --no-install-recommends nvtop
73
+
74
+ # =====================================================
75
+ # Node.js + tools
76
+ # =====================================================
77
+ RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - && \
78
  apt-get install -y nodejs && \
79
+ npm install -g \
80
+ configurable-http-proxy \
81
+ tsx \
82
+ tslab \
83
+ http-server \
84
+ miniflare@2
85
 
86
+ # =====================================================
87
+ # User setup
88
+ # =====================================================
89
+ WORKDIR /app
90
+
91
+ RUN adduser --disabled-password --gecos '' --shell /bin/bash user && \
92
+ chown -R user:user /app
93
+
94
+ RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
95
+
96
+ USER user
97
 
98
  ENV HOME=/home/user
 
 
99
 
100
+ RUN mkdir -p $HOME/.cache $HOME/.config && \
101
+ chmod -R 777 $HOME
102
 
103
+ # =====================================================
104
  # Miniconda
105
+ # =====================================================
106
+ ENV CONDA_AUTO_UPDATE_CONDA=false \
107
+ PATH=$HOME/miniconda/bin:$PATH \
108
+ PYTHONPATH=$HOME/app
109
+
110
+ RUN curl -sLo ~/miniconda.sh \
111
+ https://repo.anaconda.com/miniconda/Miniconda3-py310_23.5.2-0-Linux-x86_64.sh && \
112
  chmod +x ~/miniconda.sh && \
113
  ~/miniconda.sh -b -p ~/miniconda && \
114
+ rm ~/miniconda.sh && \
115
+ conda clean -ya
116
 
117
+ WORKDIR $HOME/app
 
 
 
 
118
 
119
+ # =====================================================
120
+ # ROOT SECTION
121
+ # =====================================================
122
  USER root
123
 
124
+ COPY packages.txt /root/packages.txt
 
 
 
 
 
 
 
 
 
 
 
125
 
126
+ RUN apt-get update && \
127
+ xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends && \
128
+ rm -rf /var/lib/apt/lists/*
129
 
130
+ COPY on_startup.sh /root/on_startup.sh
 
 
 
131
 
132
+ RUN bash /root/on_startup.sh || true
 
 
 
133
 
134
+ # =====================================================
135
+ # USER SECTION
136
+ # =====================================================
137
+ USER user
138
 
139
+ # =====================================================
140
+ # Python dependencies
141
+ # =====================================================
142
+ COPY requirements.txt $HOME/app/
143
+
144
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
145
+
146
+ # =====================================================
147
+ # AI AGENT LAYER
148
+ # =====================================================
149
+ COPY --chown=user app/agent $HOME/app/agent
150
+
151
+ # =====================================================
152
+ # FULL APPLICATION SOURCE
153
+ # =====================================================
154
+ COPY --chown=user . $HOME/app
155
+
156
+ WORKDIR $HOME/app
157
+
158
+ # =====================================================
159
+ # Playwright
160
+ # =====================================================
161
+ RUN pip install playwright && \
162
+ playwright install --with-deps || true
163
+
164
+ # =====================================================
165
+ # Permissions
166
+ # =====================================================
167
+ RUN chmod +x start_server.sh || true
168
+
169
+ # =====================================================
170
+ # Runtime ENV
171
+ # =====================================================
172
+ ENV GRADIO_ALLOW_FLAGGING=never \
173
+ GRADIO_NUM_PORTS=1 \
174
+ GRADIO_SERVER_NAME=0.0.0.0 \
175
+ GRADIO_THEME=huggingface \
176
+ SYSTEM=spaces \
177
+ SHELL=/bin/bash
178
 
179
  EXPOSE 7860 3000
180