AbuAlone09 commited on
Commit
cc612f9
·
verified ·
1 Parent(s): 77b5756

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -7
Dockerfile CHANGED
@@ -55,13 +55,17 @@ COPY --chown=user:user --from=frontend-builder /build/public ./frontend/public
55
  COPY --chown=user:user --from=frontend-builder /build/package.json ./frontend/
56
  COPY --chown=user:user --from=frontend-builder /build/node_modules ./frontend/node_modules
57
 
58
- # Tạo cấu hình file start.sh
59
- # Thay toàn bộ đoạn RUN echo hiện tại bằng đoạn này:
60
- RUN printf '#!/bin/bash\nset -e\necho "🚀 Starting AnyCoder..."\nuvicorn backend_api:app --host 0.0.0.0 --port 8000 --log-level debug &\necho "⏳ Waiting for backend..."\nsleep 15\necho "🎨 Starting Frontend on port 7860..."
61
- cd frontend
62
- # Truyền biến môi trường trực tiếp vào câu lệnh thực thi
63
- PORT=7860 HOSTNAME="0.0.0.0" node .next/standalone/server.js
64
-
 
 
 
 
65
 
66
 
67
  EXPOSE 7860
 
55
  COPY --chown=user:user --from=frontend-builder /build/package.json ./frontend/
56
  COPY --chown=user:user --from=frontend-builder /build/node_modules ./frontend/node_modules
57
 
58
+ # Sử dụng RUN để thực thi chuỗi lệnh bash an toàn
59
+ RUN printf '#!/bin/bash\n\
60
+ set -e\n\
61
+ echo "🚀 Starting AnyCoder..."\n\
62
+ uvicorn backend_api:app --host 0.0.0.0 --port 8000 --log-level debug &\n\
63
+ echo " Waiting for backend..."\n\
64
+ sleep 15\n\
65
+ echo "🎨 Starting Frontend on port 7860..."\n\
66
+ export PORT=7860\n\
67
+ export HOSTNAME="0.0.0.0"\n\
68
+ cd /home/user/app/frontend && node .next/standalone/server.js\n' > start.sh && chmod +x start.sh
69
 
70
 
71
  EXPOSE 7860