From 4b1ada1fa84b136747ad2dac2e36872fba9cac20 Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 7 Oct 2025 08:03:28 +0545 Subject: [PATCH] chore: Dockerize method --- .dockerignore | 8 ++++++ Dockerfile | 31 +++++++++++++++++++++ docker-compose.yml | 7 +++++ nginx.conf | 14 ++++++++++ static/cf4686f6f3a84cd39daaf8ca93e58448.txt | 1 + 5 files changed, 61 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 nginx.conf create mode 100644 static/cf4686f6f3a84cd39daaf8ca93e58448.txt diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..f89ae22 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +node_modules +build +.DS_Store +.env +.git +.gitignore +.vscode +*.log diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e257b4b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +# Stage 1: Build the app +FROM node:20-alpine AS builder + +# Create and set working directory +WORKDIR /app + +# Copy package files and install dependencies +COPY package*.json ./ +RUN npm ci + +# Copy the rest of the project files +COPY . . + +# Build the SvelteKit app +RUN npm run build + +# Stage 2: Run the app +FROM node:20-alpine + +WORKDIR /app + +# Copy only necessary files from builder stage +COPY --from=builder /app/package*.json ./ +COPY --from=builder /app/build ./build +COPY --from=builder /app/node_modules ./node_modules + +# Expose the port that your app runs on +EXPOSE 3000 + +# Start the SvelteKit app +CMD ["node", "build"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..8271e97 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +services: + web: + build: . + ports: + - '3080:3000' + environment: + - NODE_ENV=production diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..8cc775f --- /dev/null +++ b/nginx.conf @@ -0,0 +1,14 @@ +server { + listen 80; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +} \ No newline at end of file diff --git a/static/cf4686f6f3a84cd39daaf8ca93e58448.txt b/static/cf4686f6f3a84cd39daaf8ca93e58448.txt new file mode 100644 index 0000000..9ed79ad --- /dev/null +++ b/static/cf4686f6f3a84cd39daaf8ca93e58448.txt @@ -0,0 +1 @@ +cf4686f6f3a84cd39daaf8ca93e58448 \ No newline at end of file