udbhav commited on
Commit
30c62ef
Β·
1 Parent(s): 9d1fa65

fixing bom

Browse files
Files changed (4) hide show
  1. Dockerfile +124 -124
  2. app.py +0 -2
  3. entrypoint.sh +0 -53
  4. test.sh +0 -6
Dockerfile CHANGED
@@ -1,5 +1,89 @@
1
 
2
- # # Use NVIDIA CUDA base image (Ubuntu 22.04 jammy)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  # FROM nvidia/cuda:12.3.2-devel-ubuntu22.04
4
 
5
  # # Non-interactive apt
@@ -9,34 +93,32 @@
9
  # ENV PATH=${CUDA_HOME}/bin:/usr/local/bin:${PATH}
10
  # ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
11
 
12
- # # Proxy (auto-configurable: overridden at runtime if needed)
13
- # # ENV http_proxy=""
14
- # # ENV https_proxy=""
15
- # # ENV HTTP_PROXY=""
16
- # # ENV HTTPS_PROXY=""
17
-
18
- # # System deps + Deadsnakes PPA for Python 3.12
19
  # RUN apt-get update && apt-get install -y --no-install-recommends \
20
  # software-properties-common \
21
  # ca-certificates \
22
  # curl wget git build-essential \
23
  # libgl1-mesa-glx libglib2.0-0 libsm6 libxext6 libxrender1 \
24
  # libgomp1 libgcc-s1 \
25
- # && add-apt-repository ppa:deadsnakes/ppa -y \
26
- # && apt-get update && apt-get install -y --no-install-recommends \
27
  # python3.12 python3.12-dev python3.12-venv \
28
- # && rm -rf /var/lib/apt/lists/*
29
 
30
  # # Install pip for Python 3.12
31
  # RUN curl -sS https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py \
32
- # && python3.12 /tmp/get-pip.py \
33
- # && rm /tmp/get-pip.py
34
 
35
  # # Make 'python' and 'pip' point to 3.12
36
  # RUN ln -sf /usr/bin/python3.12 /usr/bin/python && \
37
  # ln -sf /usr/local/bin/pip3.12 /usr/local/bin/pip
38
 
39
- # # ---------------- Writable app data & HF cache ----------------
 
 
40
  # ENV APP_DATA_DIR=/data
41
  # ENV HF_HOME=/data/hf_home
42
  # ENV HUGGINGFACE_HUB_CACHE=/data/hf_home
@@ -44,14 +126,18 @@
44
  # ENV MPLCONFIGDIR=/data/matplotlib
45
 
46
  # RUN mkdir -p /data/geometry /data/solution /data/weights /data/hf_home /data/matplotlib \
47
- # && chmod -R 777 /data
48
 
49
- # # ---------------- Install frpc for Gradio share=True ----------------
 
 
50
  # RUN mkdir -p /data/hf_home/gradio/frpc && \
51
  # wget https://cdn-media.huggingface.co/frpc-gradio-0.3/frpc_linux_amd64 -O /data/hf_home/gradio/frpc/frpc_linux_amd64_v0.3 && \
52
  # chmod +x /data/hf_home/gradio/frpc/frpc_linux_amd64_v0.3
53
 
54
- # # ---------------- Application setup ----------------
 
 
55
  # WORKDIR /app
56
 
57
  # # Copy requirements first (better caching)
@@ -59,7 +145,7 @@
59
 
60
  # # Install Python deps
61
  # RUN pip install --no-cache-dir --upgrade pip setuptools wheel \
62
- # && pip install --no-cache-dir -r requirements.txt
63
 
64
  # # Copy the rest of the source
65
  # COPY . .
@@ -69,15 +155,26 @@
69
 
70
  # # Permissions
71
  # RUN chmod +x app.py
 
 
 
 
 
 
 
 
 
 
72
  # RUN chown -R 1000:1000 /app
73
 
74
  # # Expose Gradio port
75
  # EXPOSE 7860
76
 
77
- # # Run app
78
- # CMD ["python", "app.py"]
79
-
80
 
 
 
81
 
82
 
83
 
@@ -86,6 +183,8 @@
86
  # # -------------------------------------------------------------
87
  # FROM nvidia/cuda:12.3.2-devel-ubuntu22.04
88
 
 
 
89
  # # Non-interactive apt
90
  # ENV DEBIAN_FRONTEND=noninteractive
91
  # ENV PYTHONUNBUFFERED=1
@@ -153,120 +252,21 @@
153
  # # Create cache directory for downloaded repos
154
  # RUN mkdir -p /app/cache && chmod 777 /app/cache
155
 
156
- # # Permissions
157
  # RUN chmod +x app.py
158
 
159
-
160
  # # -------------------------------------------------------------
161
  # # Entrypoint for handling corporate CA certs + app launch
162
  # # -------------------------------------------------------------
163
  # COPY entrypoint.sh /entrypoint.sh
164
  # RUN chmod +x /entrypoint.sh
165
 
166
-
167
- # # SWITCH TO USER
168
- # RUN chown -R 1000:1000 /app
169
-
170
  # # Expose Gradio port
171
  # EXPOSE 7860
172
 
173
- # # Run app via entrypoint (this script will handle cert injection at runtime)
174
- # ENTRYPOINT ["/entrypoint.sh"]
 
175
 
176
  # # Default command
177
  # CMD ["python", "app.py"]
178
-
179
-
180
-
181
- # -------------------------------------------------------------
182
- # Base image: NVIDIA CUDA (Ubuntu 22.04 jammy)
183
- # -------------------------------------------------------------
184
- FROM nvidia/cuda:12.3.2-devel-ubuntu22.04
185
-
186
- USER root
187
-
188
- # Non-interactive apt
189
- ENV DEBIAN_FRONTEND=noninteractive
190
- ENV PYTHONUNBUFFERED=1
191
- ENV CUDA_HOME=/usr/local/cuda
192
- ENV PATH=${CUDA_HOME}/bin:/usr/local/bin:${PATH}
193
- ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
194
-
195
- # -------------------------------------------------------------
196
- # System dependencies + Python 3.12
197
- # -------------------------------------------------------------
198
- RUN apt-get update && apt-get install -y --no-install-recommends \
199
- software-properties-common \
200
- ca-certificates \
201
- curl wget git build-essential \
202
- libgl1-mesa-glx libglib2.0-0 libsm6 libxext6 libxrender1 \
203
- libgomp1 libgcc-s1 \
204
- && add-apt-repository ppa:deadsnakes/ppa -y \
205
- && apt-get update && apt-get install -y --no-install-recommends \
206
- python3.12 python3.12-dev python3.12-venv \
207
- && rm -rf /var/lib/apt/lists/*
208
-
209
- # Install pip for Python 3.12
210
- RUN curl -sS https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py \
211
- && python3.12 /tmp/get-pip.py \
212
- && rm /tmp/get-pip.py
213
-
214
- # Make 'python' and 'pip' point to 3.12
215
- RUN ln -sf /usr/bin/python3.12 /usr/bin/python && \
216
- ln -sf /usr/local/bin/pip3.12 /usr/local/bin/pip
217
-
218
- # -------------------------------------------------------------
219
- # Writable app data & Hugging Face cache
220
- # -------------------------------------------------------------
221
- ENV APP_DATA_DIR=/data
222
- ENV HF_HOME=/data/hf_home
223
- ENV HUGGINGFACE_HUB_CACHE=/data/hf_home
224
- ENV TRANSFORMERS_CACHE=/data/hf_home
225
- ENV MPLCONFIGDIR=/data/matplotlib
226
-
227
- RUN mkdir -p /data/geometry /data/solution /data/weights /data/hf_home /data/matplotlib \
228
- && chmod -R 777 /data
229
-
230
- # -------------------------------------------------------------
231
- # Install frpc (for Gradio share=True, though share=False is default)
232
- # -------------------------------------------------------------
233
- RUN mkdir -p /data/hf_home/gradio/frpc && \
234
- wget https://cdn-media.huggingface.co/frpc-gradio-0.3/frpc_linux_amd64 -O /data/hf_home/gradio/frpc/frpc_linux_amd64_v0.3 && \
235
- chmod +x /data/hf_home/gradio/frpc/frpc_linux_amd64_v0.3
236
-
237
- # -------------------------------------------------------------
238
- # Application setup
239
- # -------------------------------------------------------------
240
- WORKDIR /app
241
-
242
- # Copy requirements first (better caching)
243
- COPY requirements.txt .
244
-
245
- # Install Python deps
246
- RUN pip install --no-cache-dir --upgrade pip setuptools wheel \
247
- && pip install --no-cache-dir -r requirements.txt
248
-
249
- # Copy the rest of the source
250
- COPY . .
251
-
252
- # Create cache directory for downloaded repos
253
- RUN mkdir -p /app/cache && chmod 777 /app/cache
254
-
255
- # Permissions (optional, since we run as root)
256
- RUN chmod +x app.py
257
-
258
- # -------------------------------------------------------------
259
- # Entrypoint for handling corporate CA certs + app launch
260
- # -------------------------------------------------------------
261
- COPY entrypoint.sh /entrypoint.sh
262
- RUN chmod +x /entrypoint.sh
263
-
264
- # Expose Gradio port
265
- EXPOSE 7860
266
-
267
- # Run app via entrypoint (root user always)
268
- ENTRYPOINT ["bash", "/entrypoint.sh"]
269
-
270
-
271
- # Default command
272
- CMD ["python", "app.py"]
 
1
 
2
+ # Use NVIDIA CUDA base image (Ubuntu 22.04 jammy)
3
+ FROM nvidia/cuda:12.3.2-devel-ubuntu22.04
4
+
5
+ # Non-interactive apt
6
+ ENV DEBIAN_FRONTEND=noninteractive
7
+ ENV PYTHONUNBUFFERED=1
8
+ ENV CUDA_HOME=/usr/local/cuda
9
+ ENV PATH=${CUDA_HOME}/bin:/usr/local/bin:${PATH}
10
+ ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
11
+
12
+ # Proxy (auto-configurable: overridden at runtime if needed)
13
+ # ENV http_proxy=""
14
+ # ENV https_proxy=""
15
+ # ENV HTTP_PROXY=""
16
+ # ENV HTTPS_PROXY=""
17
+
18
+ # System deps + Deadsnakes PPA for Python 3.12
19
+ RUN apt-get update && apt-get install -y --no-install-recommends \
20
+ software-properties-common \
21
+ ca-certificates \
22
+ curl wget git build-essential \
23
+ libgl1-mesa-glx libglib2.0-0 libsm6 libxext6 libxrender1 \
24
+ libgomp1 libgcc-s1 \
25
+ && add-apt-repository ppa:deadsnakes/ppa -y \
26
+ && apt-get update && apt-get install -y --no-install-recommends \
27
+ python3.12 python3.12-dev python3.12-venv \
28
+ && rm -rf /var/lib/apt/lists/*
29
+
30
+ # Install pip for Python 3.12
31
+ RUN curl -sS https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py \
32
+ && python3.12 /tmp/get-pip.py \
33
+ && rm /tmp/get-pip.py
34
+
35
+ # Make 'python' and 'pip' point to 3.12
36
+ RUN ln -sf /usr/bin/python3.12 /usr/bin/python && \
37
+ ln -sf /usr/local/bin/pip3.12 /usr/local/bin/pip
38
+
39
+ # ---------------- Writable app data & HF cache ----------------
40
+ ENV APP_DATA_DIR=/data
41
+ ENV HF_HOME=/data/hf_home
42
+ ENV HUGGINGFACE_HUB_CACHE=/data/hf_home
43
+ ENV TRANSFORMERS_CACHE=/data/hf_home
44
+ ENV MPLCONFIGDIR=/data/matplotlib
45
+
46
+ RUN mkdir -p /data/geometry /data/solution /data/weights /data/hf_home /data/matplotlib \
47
+ && chmod -R 777 /data
48
+
49
+ # ---------------- Install frpc for Gradio share=True ----------------
50
+ RUN mkdir -p /data/hf_home/gradio/frpc && \
51
+ wget https://cdn-media.huggingface.co/frpc-gradio-0.3/frpc_linux_amd64 -O /data/hf_home/gradio/frpc/frpc_linux_amd64_v0.3 && \
52
+ chmod +x /data/hf_home/gradio/frpc/frpc_linux_amd64_v0.3
53
+
54
+ # ---------------- Application setup ----------------
55
+ WORKDIR /app
56
+
57
+ # Copy requirements first (better caching)
58
+ COPY requirements.txt .
59
+
60
+ # Install Python deps
61
+ RUN pip install --no-cache-dir --upgrade pip setuptools wheel \
62
+ && pip install --no-cache-dir -r requirements.txt
63
+
64
+ # Copy the rest of the source
65
+ COPY . .
66
+
67
+ # Create cache directory for downloaded repos
68
+ RUN mkdir -p /app/cache && chmod 777 /app/cache
69
+
70
+ # Permissions
71
+ RUN chmod +x app.py
72
+ RUN chown -R 1000:1000 /app
73
+
74
+ # Expose Gradio port
75
+ EXPOSE 7860
76
+
77
+ # Run app
78
+ CMD ["python", "app.py"]
79
+
80
+
81
+
82
+
83
+
84
+ # # -------------------------------------------------------------
85
+ # # Base image: NVIDIA CUDA (Ubuntu 22.04 jammy)
86
+ # # -------------------------------------------------------------
87
  # FROM nvidia/cuda:12.3.2-devel-ubuntu22.04
88
 
89
  # # Non-interactive apt
 
93
  # ENV PATH=${CUDA_HOME}/bin:/usr/local/bin:${PATH}
94
  # ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
95
 
96
+ # # -------------------------------------------------------------
97
+ # # System dependencies + Python 3.12
98
+ # # -------------------------------------------------------------
 
 
 
 
99
  # RUN apt-get update && apt-get install -y --no-install-recommends \
100
  # software-properties-common \
101
  # ca-certificates \
102
  # curl wget git build-essential \
103
  # libgl1-mesa-glx libglib2.0-0 libsm6 libxext6 libxrender1 \
104
  # libgomp1 libgcc-s1 \
105
+ # && add-apt-repository ppa:deadsnakes/ppa -y \
106
+ # && apt-get update && apt-get install -y --no-install-recommends \
107
  # python3.12 python3.12-dev python3.12-venv \
108
+ # && rm -rf /var/lib/apt/lists/*
109
 
110
  # # Install pip for Python 3.12
111
  # RUN curl -sS https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py \
112
+ # && python3.12 /tmp/get-pip.py \
113
+ # && rm /tmp/get-pip.py
114
 
115
  # # Make 'python' and 'pip' point to 3.12
116
  # RUN ln -sf /usr/bin/python3.12 /usr/bin/python && \
117
  # ln -sf /usr/local/bin/pip3.12 /usr/local/bin/pip
118
 
119
+ # # -------------------------------------------------------------
120
+ # # Writable app data & Hugging Face cache
121
+ # # -------------------------------------------------------------
122
  # ENV APP_DATA_DIR=/data
123
  # ENV HF_HOME=/data/hf_home
124
  # ENV HUGGINGFACE_HUB_CACHE=/data/hf_home
 
126
  # ENV MPLCONFIGDIR=/data/matplotlib
127
 
128
  # RUN mkdir -p /data/geometry /data/solution /data/weights /data/hf_home /data/matplotlib \
129
+ # && chmod -R 777 /data
130
 
131
+ # # -------------------------------------------------------------
132
+ # # Install frpc (for Gradio share=True, though share=False is default)
133
+ # # -------------------------------------------------------------
134
  # RUN mkdir -p /data/hf_home/gradio/frpc && \
135
  # wget https://cdn-media.huggingface.co/frpc-gradio-0.3/frpc_linux_amd64 -O /data/hf_home/gradio/frpc/frpc_linux_amd64_v0.3 && \
136
  # chmod +x /data/hf_home/gradio/frpc/frpc_linux_amd64_v0.3
137
 
138
+ # # -------------------------------------------------------------
139
+ # # Application setup
140
+ # # -------------------------------------------------------------
141
  # WORKDIR /app
142
 
143
  # # Copy requirements first (better caching)
 
145
 
146
  # # Install Python deps
147
  # RUN pip install --no-cache-dir --upgrade pip setuptools wheel \
148
+ # && pip install --no-cache-dir -r requirements.txt
149
 
150
  # # Copy the rest of the source
151
  # COPY . .
 
155
 
156
  # # Permissions
157
  # RUN chmod +x app.py
158
+
159
+
160
+ # # -------------------------------------------------------------
161
+ # # Entrypoint for handling corporate CA certs + app launch
162
+ # # -------------------------------------------------------------
163
+ # COPY entrypoint.sh /entrypoint.sh
164
+ # RUN chmod +x /entrypoint.sh
165
+
166
+
167
+ # # SWITCH TO USER
168
  # RUN chown -R 1000:1000 /app
169
 
170
  # # Expose Gradio port
171
  # EXPOSE 7860
172
 
173
+ # # Run app via entrypoint (this script will handle cert injection at runtime)
174
+ # ENTRYPOINT ["/entrypoint.sh"]
 
175
 
176
+ # # Default command
177
+ # CMD ["python", "app.py"]
178
 
179
 
180
 
 
183
  # # -------------------------------------------------------------
184
  # FROM nvidia/cuda:12.3.2-devel-ubuntu22.04
185
 
186
+ # USER root
187
+
188
  # # Non-interactive apt
189
  # ENV DEBIAN_FRONTEND=noninteractive
190
  # ENV PYTHONUNBUFFERED=1
 
252
  # # Create cache directory for downloaded repos
253
  # RUN mkdir -p /app/cache && chmod 777 /app/cache
254
 
255
+ # # Permissions (optional, since we run as root)
256
  # RUN chmod +x app.py
257
 
 
258
  # # -------------------------------------------------------------
259
  # # Entrypoint for handling corporate CA certs + app launch
260
  # # -------------------------------------------------------------
261
  # COPY entrypoint.sh /entrypoint.sh
262
  # RUN chmod +x /entrypoint.sh
263
 
 
 
 
 
264
  # # Expose Gradio port
265
  # EXPOSE 7860
266
 
267
+ # # Run app via entrypoint (root user always)
268
+ # ENTRYPOINT ["bash", "/entrypoint.sh"]
269
+
270
 
271
  # # Default command
272
  # CMD ["python", "app.py"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app.py CHANGED
@@ -101,6 +101,4 @@ def main():
101
 
102
  if __name__ == "__main__":
103
  main()
104
- import socket
105
- print("Server listening on:", socket.gethostbyname(socket.gethostname()), ":7860")
106
 
 
101
 
102
  if __name__ == "__main__":
103
  main()
 
 
104
 
entrypoint.sh DELETED
@@ -1,53 +0,0 @@
1
- # #!/bin/bash
2
- # set -e
3
-
4
- # # If secrets exist, decode them
5
- # if [ -n "$CORP_CERT1" ]; then
6
- # echo "$CORP_CERT1" | base64 -d > /usr/local/share/ca-certificates/corp_cert1.crt
7
- # fi
8
- # if [ -n "$CORP_CERT2" ]; then
9
- # echo "$CORP_CERT2" | base64 -d > /usr/local/share/ca-certificates/corp_cert2.crt
10
- # fi
11
- # if [ -n "$CORP_CERT3" ]; then
12
- # echo "$CORP_CERT3" | base64 -d > /usr/local/share/ca-certificates/corp_cert3.crt
13
- # fi
14
- # if [ -n "$CORP_CERT4" ]; then
15
- # echo "$CORP_CERT4" | base64 -d > /usr/local/share/ca-certificates/corp_cert4.crt
16
- # fi
17
-
18
- # # Update CA store if any certs were added
19
- # update-ca-certificates || true
20
-
21
- # # Finally run your app
22
- # exec python app.py
23
-
24
-
25
- #!/bin/bash
26
- set -e
27
-
28
- CERT_DIR=/data/certs
29
- mkdir -p "$CERT_DIR"
30
-
31
- if [ -n "$CORP_CERT1" ]; then
32
- echo "$CORP_CERT1" | base64 -d > "$CERT_DIR/corp_cert1.crt"
33
- fi
34
- if [ -n "$CORP_CERT2" ]; then
35
- echo "$CORP_CERT2" | base64 -d > "$CERT_DIR/corp_cert2.crt"
36
- fi
37
- if [ -n "$CORP_CERT3" ]; then
38
- echo "$CORP_CERT3" | base64 -d > "$CERT_DIR/corp_cert3.crt"
39
- fi
40
- if [ -n "$CORP_CERT4" ]; then
41
- echo "$CORP_CERT4" | base64 -d > "$CERT_DIR/corp_cert4.crt"
42
- fi
43
-
44
- cat "$CERT_DIR"/*.crt > "$CERT_DIR/corp_bundle.crt" 2>/dev/null || true
45
- export REQUESTS_CA_BUNDLE="$CERT_DIR/corp_bundle.crt"
46
-
47
- echo "βœ… Corporate certs configured (if provided)."
48
- echo "πŸ”— REQUESTS_CA_BUNDLE set to $REQUESTS_CA_BUNDLE"
49
-
50
- exec "$@"
51
-
52
-
53
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
test.sh DELETED
@@ -1,6 +0,0 @@
1
- for f in *.sh; do
2
- echo "Fixing $f"
3
- sed -i '1s/^\xEF\xBB\xBF//' "$f" # remove BOM if present
4
- dos2unix "$f" 2>/dev/null || sed -i 's/\r$//' "$f" # convert CRLF β†’ LF
5
- chmod +x "$f" # make executable
6
- done