From 572ae483676f1b0921cb439c1201dffa39e2d35e Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Mar 2026 15:25:22 +0800 Subject: [PATCH] feat: add frontend Dockerfile and nginx config Co-Authored-By: Claude Opus 4.6 --- imagecreator/frontend/Dockerfile | 14 ++++++++++++++ imagecreator/frontend/nginx.conf | 21 +++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 imagecreator/frontend/Dockerfile create mode 100644 imagecreator/frontend/nginx.conf diff --git a/imagecreator/frontend/Dockerfile b/imagecreator/frontend/Dockerfile new file mode 100644 index 0000000..023efb0 --- /dev/null +++ b/imagecreator/frontend/Dockerfile @@ -0,0 +1,14 @@ +FROM node:20-alpine as builder + +WORKDIR /app +COPY package.json ./ +RUN npm install +COPY . . +RUN npm run build + +FROM nginx:alpine +COPY --from=builder /app/dist /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf + +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/imagecreator/frontend/nginx.conf b/imagecreator/frontend/nginx.conf new file mode 100644 index 0000000..2c91309 --- /dev/null +++ b/imagecreator/frontend/nginx.conf @@ -0,0 +1,21 @@ +server { + listen 80; + server_name localhost; + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } + + location /api/ { + proxy_pass http://backend:8000/api/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + + location /uploads/ { + proxy_pass http://backend:8000/uploads/; + proxy_set_header Host $host; + } +} \ No newline at end of file