From 37ad47b7d8046507e759040e2701b9a173658127 Mon Sep 17 00:00:00 2001 From: Hammer Date: Thu, 29 Jan 2026 15:19:10 +0000 Subject: [PATCH] =?UTF-8?q?Add=20Dockerfile=20for=20multi-stage=20build=20?= =?UTF-8?q?(node=20=E2=86=92=20nginx)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ecab6d5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +# Stage 1: Build +FROM node:20-alpine AS build +WORKDIR /app +COPY package.json bun.lock ./ +RUN npm install +COPY . . +ARG VITE_API_URL=https://api.nkode.donovankelly.xyz +ENV VITE_API_URL=$VITE_API_URL +RUN npm run build + +# Stage 2: Serve +FROM nginx:alpine +COPY --from=build /app/dist /usr/share/nginx/html +# SPA routing: all paths → index.html +RUN printf 'server {\n listen 80;\n root /usr/share/nginx/html;\n index index.html;\n location / {\n try_files $uri $uri/ /index.html;\n }\n}\n' > /etc/nginx/conf.d/default.conf +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"]