From 2ae9f7932a89a08f740837022364c963197dda79 Mon Sep 17 00:00:00 2001 From: backuppc Date: Fri, 16 Jan 2026 14:42:56 +0900 Subject: [PATCH] =?UTF-8?q?=20=20Dockerfile=EC=9D=80=20Node.js=20=ED=99=98?= =?UTF-8?q?=EA=B2=BD=EC=97=90=EC=84=9C=20=EB=B9=8C=EB=93=9C=20=ED=9B=84=20?= =?UTF-8?q?Nginx=EB=A1=9C=20=EC=A0=95=EC=A0=81=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=EC=9D=84=20=EC=A0=9C=EA=B3=B5=ED=95=98=EB=A9=B0,=20=EC=95=9E?= =?UTF-8?q?=EC=84=9C=20=EC=84=A4=EC=A0=95=ED=95=9C=20nginx.conf=EB=A5=BC?= =?UTF-8?q?=20=EC=82=AC=EC=9A=A9=ED=95=A9=EB=8B=88=EB=8B=A4.=20=20=20vite.?= =?UTF-8?q?config.ts=EC=9D=98=20base:=20'/serial/'=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=EC=97=90=20=EB=A7=9E=EC=B6=B0=20=EB=B9=8C=EB=93=9C=EB=90=9C=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=EC=9D=84=20/usr/share/nginx/html/serial=20?= =?UTF-8?q?=EB=94=94=EB=A0=89=ED=86=A0=EB=A6=AC=EB=A1=9C=20=EB=B3=B5?= =?UTF-8?q?=EC=82=AC=ED=95=A9=EB=8B=88=EB=8B=A4.=20=20=20EXPOSE=2080?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=2080=20=ED=8F=AC=ED=8A=B8=EB=A5=BC=20?= =?UTF-8?q?=EA=B0=9C=EB=B0=A9=ED=95=A9=EB=8B=88=EB=8B=A4.=20=E2=9C=A6=20Do?= =?UTF-8?q?ckerfile=EA=B3=BC=20nginx.conf=20=EC=83=9D=EC=84=B1=EC=9D=B4=20?= =?UTF-8?q?=EC=99=84=EB=A3=8C=EB=90=98=EC=97=88=EC=8A=B5=EB=8B=88=EB=8B=A4?= =?UTF-8?q?.=20=EC=9D=B4=EC=A0=9C=20=EB=B3=80=EA=B2=BD=20=EC=82=AC?= =?UTF-8?q?=ED=95=AD=EC=9D=84=20=EC=BB=A4=EB=B0=8B=ED=95=98=EA=B3=A0=20?= =?UTF-8?q?=ED=91=B8=EC=8B=9C=ED=95=98=EA=B2=A0=EC=8A=B5=EB=8B=88=EB=8B=A4?= =?UTF-8?q?.=20=20=20(=EC=B0=B8=EA=B3=A0:=20vite.config.ts=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20=EC=82=AC=ED=95=AD=EB=8F=84=20=ED=95=A8=EA=BB=98=20?= =?UTF-8?q?=ED=8F=AC=ED=95=A8=ED=95=A9=EB=8B=88=EB=8B=A4.)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 27 +++++++++++++++++++++++++++ nginx.conf | 17 +++++++++++++++++ vite.config.ts | 1 + 3 files changed, 45 insertions(+) create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..048c331 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +# Build stage +FROM node:20-alpine as build +WORKDIR /app + +# Copy package files and install dependencies +COPY package*.json ./ +RUN npm install + +# Copy source code and build +COPY . . +RUN npm run build + +# Production stage +FROM nginx:alpine + +# Remove default nginx static assets +RUN rm -rf /usr/share/nginx/html/* + +# Copy built artifacts to /serial subdirectory to match base path +COPY --from=build /app/dist /usr/share/nginx/html/serial + +# Copy custom nginx configuration +COPY nginx.conf /etc/nginx/conf.d/default.conf + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..67f289e --- /dev/null +++ b/nginx.conf @@ -0,0 +1,17 @@ +server { + listen 80; + server_name localhost; + + location /serial/ { + alias /usr/share/nginx/html/serial/; + try_files $uri $uri/ /serial/index.html; + } + + # Health check endpoint (optional but good for deployments) + location /health { + access_log off; + add_header 'Content-Type' 'text/plain'; + return 200 "healthy\n"; + } +} + diff --git a/vite.config.ts b/vite.config.ts index ee5fb8d..a55ab61 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -5,6 +5,7 @@ import react from '@vitejs/plugin-react'; export default defineConfig(({ mode }) => { const env = loadEnv(mode, '.', ''); return { + base: '/serial/', server: { port: 3000, host: '0.0.0.0',