chore: Dockerize method

This commit is contained in:
2025-10-07 08:03:28 +05:45
parent be4db34031
commit 4b1ada1fa8
5 changed files with 61 additions and 0 deletions

8
.dockerignore Normal file
View File

@@ -0,0 +1,8 @@
node_modules
build
.DS_Store
.env
.git
.gitignore
.vscode
*.log

31
Dockerfile Normal file
View File

@@ -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"]

7
docker-compose.yml Normal file
View File

@@ -0,0 +1,7 @@
services:
web:
build: .
ports:
- '3080:3000'
environment:
- NODE_ENV=production

14
nginx.conf Normal file
View File

@@ -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;
}
}

View File

@@ -0,0 +1 @@
cf4686f6f3a84cd39daaf8ca93e58448