Update Dockerfile
Browse files- Dockerfile +57 -21
Dockerfile
CHANGED
@@ -39,33 +39,65 @@ RUN apt-get update && apt-get install -y \
|
|
39 |
|
40 |
# Configure nginx
|
41 |
RUN rm /etc/nginx/sites-enabled/default || true
|
42 |
-
COPY <<EOF /etc/nginx/
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
54 |
}
|
55 |
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
}
|
64 |
}
|
65 |
EOF
|
66 |
|
67 |
-
RUN
|
68 |
-
mkdir -p /var/log/nginx && \
|
69 |
chown -R user:user /var/log/nginx && \
|
70 |
touch /run/nginx.pid && \
|
71 |
chown -R user:user /run/nginx.pid && \
|
@@ -207,6 +239,10 @@ cd /app/api && poetry run python -m gunicorn app:app \\\n\
|
|
207 |
# Start frontend server\n\
|
208 |
cd /app/web && PORT=3000 node server.js &\n\
|
209 |
\n\
|
|
|
|
|
|
|
|
|
210 |
# Start nginx\n\
|
211 |
nginx -g "daemon off;" &\n\
|
212 |
\n\
|
|
|
39 |
|
40 |
# Configure nginx
|
41 |
RUN rm /etc/nginx/sites-enabled/default || true
|
42 |
+
COPY <<EOF /etc/nginx/nginx.conf
|
43 |
+
events {
|
44 |
+
worker_connections 1024;
|
45 |
+
}
|
46 |
+
|
47 |
+
http {
|
48 |
+
include /etc/nginx/mime.types;
|
49 |
+
default_type application/octet-stream;
|
50 |
+
sendfile on;
|
51 |
+
keepalive_timeout 65;
|
52 |
+
|
53 |
+
upstream frontend {
|
54 |
+
server 127.0.0.1:3000;
|
55 |
}
|
56 |
|
57 |
+
upstream backend {
|
58 |
+
server 127.0.0.1:5001;
|
59 |
+
}
|
60 |
+
|
61 |
+
server {
|
62 |
+
listen 7860;
|
63 |
+
server_name _;
|
64 |
+
client_max_body_size 100M;
|
65 |
+
|
66 |
+
location / {
|
67 |
+
proxy_pass http://frontend;
|
68 |
+
proxy_http_version 1.1;
|
69 |
+
proxy_set_header Upgrade $http_upgrade;
|
70 |
+
proxy_set_header Connection 'upgrade';
|
71 |
+
proxy_set_header Host $host;
|
72 |
+
proxy_cache_bypass $http_upgrade;
|
73 |
+
proxy_set_header X-Real-IP $remote_addr;
|
74 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
75 |
+
proxy_set_header X-Forwarded-Proto $scheme;
|
76 |
+
proxy_read_timeout 300s;
|
77 |
+
proxy_connect_timeout 75s;
|
78 |
+
}
|
79 |
+
|
80 |
+
location /api {
|
81 |
+
proxy_pass http://backend;
|
82 |
+
proxy_http_version 1.1;
|
83 |
+
proxy_set_header Upgrade $http_upgrade;
|
84 |
+
proxy_set_header Connection 'upgrade';
|
85 |
+
proxy_set_header Host $host;
|
86 |
+
proxy_cache_bypass $http_upgrade;
|
87 |
+
proxy_set_header X-Real-IP $remote_addr;
|
88 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
89 |
+
proxy_set_header X-Forwarded-Proto $scheme;
|
90 |
+
proxy_read_timeout 300s;
|
91 |
+
proxy_connect_timeout 75s;
|
92 |
+
}
|
93 |
+
|
94 |
+
access_log /var/log/nginx/access.log;
|
95 |
+
error_log /var/log/nginx/error.log;
|
96 |
}
|
97 |
}
|
98 |
EOF
|
99 |
|
100 |
+
RUN mkdir -p /var/log/nginx && \
|
|
|
101 |
chown -R user:user /var/log/nginx && \
|
102 |
touch /run/nginx.pid && \
|
103 |
chown -R user:user /run/nginx.pid && \
|
|
|
239 |
# Start frontend server\n\
|
240 |
cd /app/web && PORT=3000 node server.js &\n\
|
241 |
\n\
|
242 |
+
# Wait for services to be ready\n\
|
243 |
+
echo "Waiting for services to be ready..."\n\
|
244 |
+
sleep 5\n\
|
245 |
+
\n\
|
246 |
# Start nginx\n\
|
247 |
nginx -g "daemon off;" &\n\
|
248 |
\n\
|