| FROM ghcr.io/fish2018/pansou-web:latest |
| ENV ENABLED_PLUGINS="labi,zhizhen,shandian,duoduo,muou,wanou" |
| USER root |
|
|
| |
| RUN mkdir -p /var/cache/nginx/client_temp \ |
| /var/cache/nginx/proxy_temp \ |
| /var/cache/nginx/fastcgi_temp \ |
| /var/cache/nginx/uwsgi_temp \ |
| /var/cache/nginx/scgi_temp \ |
| /var/run \ |
| /var/log/nginx \ |
| /app/cache && \ |
| chmod -R 777 /var/cache/nginx \ |
| /var/run \ |
| /var/log/nginx \ |
| /app/cache |
|
|
| |
| RUN rm -f /etc/nginx/conf.d/*.conf /etc/nginx/sites-enabled/* /etc/nginx/sites-available/* 2>/dev/null || true |
|
|
| |
| RUN cat > /etc/nginx/conf.d/pansou.conf <<'EOF' |
| server { |
| listen 7860 default_server; |
| server_name _; |
| |
| |
| root /app/frontend/dist; |
| index index.html; |
| |
| |
| location / { |
| try_files $uri $uri/ /index.html; |
| } |
| |
| |
| location /api/ { |
| proxy_pass http://127.0.0.1:8888; |
| proxy_set_header Host $host; |
| proxy_set_header X-Real-IP $remote_addr; |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| proxy_set_header X-Forwarded-Proto $scheme; |
| proxy_connect_timeout 30s; |
| proxy_send_timeout 30s; |
| proxy_read_timeout 30s; |
| } |
| } |
| EOF |
|
|
| |
| RUN sed -i 's/^user\s/#user /g' /etc/nginx/nginx.conf && \ |
| sed -i 's|pid\s*/var/run/nginx.pid;|pid /tmp/nginx.pid;|g' /etc/nginx/nginx.conf |
|
|
| |
| RUN echo "=== Nginx config check ===" && \ |
| cat /etc/nginx/conf.d/pansou.conf && \ |
| echo "=== End of config ===" && \ |
| ls -la /etc/nginx/conf.d/ |
|
|
| |
| RUN cat > /start.sh <<'EOF' |
| |
| set -e |
|
|
| echo "=== Starting PanSou Service ===" |
|
|
| |
| echo "Checking frontend files..." |
| ls -la /app/frontend/dist/ | head -10 |
|
|
| |
| echo "Nginx configuration:" |
| cat /etc/nginx/conf.d/pansou.conf |
|
|
| echo "Starting PanSou backend service..." |
| |
| cd /app && ./pansou & |
|
|
| |
| echo "Waiting for backend to start..." |
| sleep 3 |
|
|
| |
| if ! curl -s http://localhost:8888/api/health > /dev/null 2>&1; then |
| echo "Warning: Backend service may not be running properly" |
| else |
| echo "Backend service started successfully on port 8888" |
| fi |
|
|
| |
| echo "Testing nginx configuration..." |
| nginx -t |
|
|
| echo "Starting Nginx on port 7860..." |
| echo "Frontend root: /app/frontend/dist" |
| |
| exec nginx -g "daemon off;" |
| EOF |
|
|
| RUN chmod +x /start.sh |
|
|
| EXPOSE 7860 |
| USER 1000 |
| CMD ["/start.sh"] |