root 1 сар өмнө
parent
commit
a345702ce7
3 өөрчлөгдсөн 100 нэмэгдсэн , 0 устгасан
  1. 8 0
      .dockerignore
  2. 22 0
      Dockerfile
  3. 70 0
      nginx.conf

+ 8 - 0
.dockerignore

@@ -0,0 +1,8 @@
+.git
+node_modules
+default/node_modules
+default/dist
+classic/node_modules
+classic/dist
+.eslintcache
+*.log

+ 22 - 0
Dockerfile

@@ -0,0 +1,22 @@
+FROM oven/bun:1@sha256:0733e50325078969732ebe3b15ce4c4be5082f18c4ac1a0f0ca4839c2e4e42a7 AS builder
+
+WORKDIR /build/web
+
+COPY package.json bun.lock ./
+COPY default/package.json ./default/package.json
+COPY classic/package.json ./classic/package.json
+RUN bun install --frozen-lockfile
+
+COPY default ./default
+
+ARG VITE_REACT_APP_VERSION=split
+ENV VITE_REACT_APP_VERSION=${VITE_REACT_APP_VERSION}
+
+RUN cd default && DISABLE_ESLINT_PLUGIN='true' bun run build
+
+FROM nginx:1.29-alpine
+
+COPY nginx.conf /etc/nginx/conf.d/default.conf
+COPY --from=builder /build/web/default/dist /usr/share/nginx/html
+
+EXPOSE 80

+ 70 - 0
nginx.conf

@@ -0,0 +1,70 @@
+upstream token_backend {
+    server token-server:3000;
+}
+
+server {
+    listen 80;
+    server_name _;
+
+    root /usr/share/nginx/html;
+    index index.html;
+
+    client_max_body_size 128m;
+
+    location ~ ^/(api|v1|v1beta|mj|pg|suno|kling|jimeng)(/|$) {
+        proxy_pass http://token_backend;
+        proxy_http_version 1.1;
+        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_set_header Upgrade $http_upgrade;
+        proxy_set_header Connection $connection_upgrade;
+        proxy_buffering off;
+        proxy_read_timeout 3600s;
+        proxy_send_timeout 3600s;
+    }
+
+    location ~ ^/dashboard/billing(/|$) {
+        proxy_pass http://token_backend;
+        proxy_http_version 1.1;
+        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_set_header Upgrade $http_upgrade;
+        proxy_set_header Connection $connection_upgrade;
+        proxy_buffering off;
+        proxy_read_timeout 3600s;
+        proxy_send_timeout 3600s;
+    }
+
+    location ~ ^/[^/]+/mj(/|$) {
+        proxy_pass http://token_backend;
+        proxy_http_version 1.1;
+        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_set_header Upgrade $http_upgrade;
+        proxy_set_header Connection $connection_upgrade;
+        proxy_buffering off;
+        proxy_read_timeout 3600s;
+        proxy_send_timeout 3600s;
+    }
+
+    location ~* \.(?:js|css|png|jpg|jpeg|gif|svg|ico|webp|woff2?)$ {
+        expires 30d;
+        add_header Cache-Control "public, immutable";
+        try_files $uri =404;
+    }
+
+    location / {
+        try_files $uri $uri/ /index.html;
+    }
+}
+
+map $http_upgrade $connection_upgrade {
+    default upgrade;
+    '' close;
+}