gauthamnairy commited on
Commit
a4fe1cf
·
verified ·
1 Parent(s): 191396e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -174
Dockerfile CHANGED
@@ -11,6 +11,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
11
  # Copy application code
12
  COPY backend /app/backend
13
  COPY frontend /app/frontend
 
 
14
 
15
  # Create temp directories that nginx can write to
16
  RUN mkdir -p /tmp/nginx/client_body \
@@ -20,173 +22,6 @@ RUN mkdir -p /tmp/nginx/client_body \
20
  /tmp/nginx/scgi \
21
  && chmod -R 777 /tmp/nginx
22
 
23
- # Create a special index-hf.html file with inline styles
24
- RUN echo '<!DOCTYPE html>\n\
25
- <html lang="en">\n\
26
- <head>\n\
27
- <meta charset="UTF-8">\n\
28
- <meta name="viewport" content="width=device-width, initial-scale=1.0">\n\
29
- <title>GeoTools Hub</title>\n\
30
- <style>\n\
31
- :root {\n\
32
- --primary-blue: #4776e6;\n\
33
- --primary-purple: #8e54e9;\n\
34
- --secondary-blue: #00c6ff;\n\
35
- --secondary-teal: #0072ff;\n\
36
- --dark-blue: #2a2d3e;\n\
37
- --text-color: #333;\n\
38
- --text-light: #fff;\n\
39
- --background-start: #f0f4ff;\n\
40
- --background-end: #ffffff;\n\
41
- --card-bg: #fff;\n\
42
- --border-color: #e1e4e8;\n\
43
- --shadow-color: rgba(0, 0, 0, 0.1);\n\
44
- --font-family: sans-serif;\n\
45
- --heading-font: sans-serif;\n\
46
- }\n\
47
- * { margin: 0; padding: 0; box-sizing: border-box; }\n\
48
- body {\n\
49
- font-family: var(--font-family);\n\
50
- background: linear-gradient(135deg, var(--background-start), var(--background-end));\n\
51
- color: var(--text-color);\n\
52
- line-height: 1.6;\n\
53
- min-height: 100vh;\n\
54
- position: relative;\n\
55
- }\n\
56
- body::before {\n\
57
- content: "";\n\
58
- position: fixed;\n\
59
- top: 0;\n\
60
- left: 0;\n\
61
- width: 100%;\n\
62
- height: 100%;\n\
63
- background-image: url("https://raw.githubusercontent.com/NathanPB/world-map-texture/master/1024px.png");\n\
64
- background-size: cover;\n\
65
- opacity: 0.12;\n\
66
- z-index: -1;\n\
67
- }\n\
68
- h1, h2, h3, h4, h5, h6 {\n\
69
- font-family: var(--heading-font);\n\
70
- font-weight: 700;\n\
71
- color: var(--dark-blue);\n\
72
- text-align: center;\n\
73
- margin: 25px 0;\n\
74
- }\n\
75
- .hero-container {\n\
76
- max-width: 1200px;\n\
77
- margin: 0 auto;\n\
78
- padding: 2rem;\n\
79
- }\n\
80
- .tool-container {\n\
81
- display: flex;\n\
82
- flex-wrap: wrap;\n\
83
- gap: 20px;\n\
84
- justify-content: center;\n\
85
- margin-top: 2rem;\n\
86
- }\n\
87
- .tool-card {\n\
88
- background: var(--card-bg);\n\
89
- border-radius: 10px;\n\
90
- box-shadow: 0 4px 8px var(--shadow-color);\n\
91
- overflow: hidden;\n\
92
- transition: transform 0.3s ease, box-shadow 0.3s ease;\n\
93
- width: 300px;\n\
94
- border: 1px solid var(--border-color);\n\
95
- }\n\
96
- .tool-card:hover {\n\
97
- transform: translateY(-5px);\n\
98
- box-shadow: 0 8px 16px var(--shadow-color);\n\
99
- }\n\
100
- .tool-card-content {\n\
101
- padding: 1.5rem;\n\
102
- }\n\
103
- .tool-card h3 {\n\
104
- color: var(--dark-blue);\n\
105
- margin-bottom: 0.75rem;\n\
106
- font-size: 1.5rem;\n\
107
- text-align: left;\n\
108
- }\n\
109
- .tool-card p {\n\
110
- margin-bottom: 1.5rem;\n\
111
- color: var(--text-color);\n\
112
- }\n\
113
- .button {\n\
114
- display: inline-block;\n\
115
- padding: 0.6rem 1.2rem;\n\
116
- background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));\n\
117
- color: white;\n\
118
- text-decoration: none;\n\
119
- border-radius: 4px;\n\
120
- font-weight: 600;\n\
121
- transition: opacity 0.3s ease;\n\
122
- }\n\
123
- .button:hover {\n\
124
- opacity: 0.9;\n\
125
- }\n\
126
- .background-text {\n\
127
- position: fixed;\n\
128
- font-size: 25vw;\n\
129
- font-weight: 800;\n\
130
- color: rgba(0, 0, 0, 0.03);\n\
131
- z-index: -2;\n\
132
- top: 50%;\n\
133
- left: 50%;\n\
134
- transform: translate(-50%, -50%);\n\
135
- white-space: nowrap;\n\
136
- }\n\
137
- @media (max-width: 768px) {\n\
138
- .tool-container {\n\
139
- flex-direction: column;\n\
140
- align-items: center;\n\
141
- }\n\
142
- }\n\
143
- </style>\n\
144
- </head>\n\
145
- <body>\n\
146
- <div class="background-text">MAP</div>\n\
147
- \n\
148
- <div class="hero-container">\n\
149
- <h1>GeoTools Hub</h1>\n\
150
- <h2>All-in-One GIS Calculation Tool</h2>\n\
151
- <p>Powerful geospatial analysis tools for professionals and enthusiasts</p>\n\
152
- \n\
153
- <a href="#" class="button">Explore Tools</a>\n\
154
- \n\
155
- <h2>GIS Tools</h2>\n\
156
- \n\
157
- <div class="tool-container">\n\
158
- <div class="tool-card">\n\
159
- <div class="tool-card-content">\n\
160
- <h3>Ground Elevation Finder</h3>\n\
161
- <p>Get precise elevation data for any location on Earth</p>\n\
162
- <a href="/elevation.html" class="button">Open Tool</a>\n\
163
- </div>\n\
164
- </div>\n\
165
- \n\
166
- <div class="tool-card">\n\
167
- <div class="tool-card-content">\n\
168
- <h3>Distance Calculator</h3>\n\
169
- <p>Coming soon</p>\n\
170
- <a href="#" class="button" style="opacity: 0.5; pointer-events: none;">Coming Soon</a>\n\
171
- </div>\n\
172
- </div>\n\
173
- \n\
174
- <div class="tool-card">\n\
175
- <div class="tool-card-content">\n\
176
- <h3>Area Calculator</h3>\n\
177
- <p>Coming soon</p>\n\
178
- <a href="#" class="button" style="opacity: 0.5; pointer-events: none;">Coming Soon</a>\n\
179
- </div>\n\
180
- </div>\n\
181
- </div>\n\
182
- </div>\n\
183
- \n\
184
- <footer style="text-align: center; margin-top: 3rem; padding-bottom: 1rem;">\n\
185
- © 2025 GeoTools Hub | Made with ❤️ for GIS professionals\n\
186
- </footer>\n\
187
- </body>\n\
188
- </html>' > /app/frontend/index-hf.html
189
-
190
  # Create a simple nginx configuration that doesn't require root
191
  RUN echo 'worker_processes auto;\n\
192
  pid /tmp/nginx.pid;\n\
@@ -223,12 +58,18 @@ http {\n\
223
  listen 7860;\n\
224
  server_name localhost;\n\
225
  \n\
226
- # Root directory\n\
227
- root /app/frontend;\n\
228
  \n\
229
- # Main route - use our special HF version\n\
230
  location = / {\n\
231
- try_files /index-hf.html =404;\n\
 
 
 
 
 
 
232
  }\n\
233
  \n\
234
  # Explicitly handle static files\n\
@@ -238,9 +79,9 @@ http {\n\
238
  try_files \$uri =404;\n\
239
  }\n\
240
  \n\
241
- # Handle routes\n\
242
  location / {\n\
243
- try_files \$uri \$uri/ /index-hf.html;\n\
244
  }\n\
245
  \n\
246
  # API proxying\n\
@@ -257,8 +98,20 @@ http {\n\
257
  # Install Python dependencies
258
  RUN pip install --no-cache-dir fastapi uvicorn httpx pyproj python-multipart
259
 
 
 
 
 
 
 
 
 
 
 
260
  # Create startup script
261
  RUN echo '#!/bin/bash\n\
 
 
262
  echo "Starting API server..."\n\
263
  cd /app && python -m uvicorn backend.main:app --host 0.0.0.0 --port 8000 &\n\
264
  echo "Starting Nginx..."\n\
@@ -269,4 +122,4 @@ nginx -g "daemon off;"\n\
269
  EXPOSE 7860
270
 
271
  # Start services
272
- CMD ["/app/start.sh"]
 
11
  # Copy application code
12
  COPY backend /app/backend
13
  COPY frontend /app/frontend
14
+ # Assuming you'll put index.html at root during deployment
15
+ COPY index.html /app/index.html
16
 
17
  # Create temp directories that nginx can write to
18
  RUN mkdir -p /tmp/nginx/client_body \
 
22
  /tmp/nginx/scgi \
23
  && chmod -R 777 /tmp/nginx
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  # Create a simple nginx configuration that doesn't require root
26
  RUN echo 'worker_processes auto;\n\
27
  pid /tmp/nginx.pid;\n\
 
58
  listen 7860;\n\
59
  server_name localhost;\n\
60
  \n\
61
+ # Root directory now at application root\n\
62
+ root /app;\n\
63
  \n\
64
+ # Main route - use root level index.html\n\
65
  location = / {\n\
66
+ try_files /index.html =404;\n\
67
+ }\n\
68
+ \n\
69
+ # Serve frontend static files\n\
70
+ location /frontend/ {\n\
71
+ root /app;\n\
72
+ try_files \$uri \$uri/ =404;\n\
73
  }\n\
74
  \n\
75
  # Explicitly handle static files\n\
 
79
  try_files \$uri =404;\n\
80
  }\n\
81
  \n\
82
+ # Handle other routes\n\
83
  location / {\n\
84
+ try_files \$uri \$uri/ /index.html;\n\
85
  }\n\
86
  \n\
87
  # API proxying\n\
 
98
  # Install Python dependencies
99
  RUN pip install --no-cache-dir fastapi uvicorn httpx pyproj python-multipart
100
 
101
+ # Create a debug info script
102
+ RUN echo '#!/bin/bash\n\
103
+ echo "App directory structure:"\n\
104
+ find /app -type f -name "*.html" | sort\n\
105
+ echo ""\n\
106
+ echo "Testing file access:"\n\
107
+ if [ -f "/app/index.html" ]; then echo "Root index.html exists"; else echo "Root index.html MISSING"; fi\n\
108
+ if [ -f "/app/frontend/elevation.html" ]; then echo "elevation.html exists"; else echo "elevation.html MISSING"; fi\n\
109
+ ' > /app/debug.sh && chmod +x /app/debug.sh
110
+
111
  # Create startup script
112
  RUN echo '#!/bin/bash\n\
113
+ echo "Running debug info:"\n\
114
+ /app/debug.sh\n\
115
  echo "Starting API server..."\n\
116
  cd /app && python -m uvicorn backend.main:app --host 0.0.0.0 --port 8000 &\n\
117
  echo "Starting Nginx..."\n\
 
122
  EXPOSE 7860
123
 
124
  # Start services
125
+ CMD ["/app/start.sh"]