chore: Dockerize method
This commit is contained in:
8
.dockerignore
Normal file
8
.dockerignore
Normal file
@@ -0,0 +1,8 @@
|
||||
node_modules
|
||||
build
|
||||
.DS_Store
|
||||
.env
|
||||
.git
|
||||
.gitignore
|
||||
.vscode
|
||||
*.log
|
||||
31
Dockerfile
Normal file
31
Dockerfile
Normal 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
7
docker-compose.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
services:
|
||||
web:
|
||||
build: .
|
||||
ports:
|
||||
- '3080:3000'
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
14
nginx.conf
Normal file
14
nginx.conf
Normal 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;
|
||||
}
|
||||
}
|
||||
1
static/cf4686f6f3a84cd39daaf8ca93e58448.txt
Normal file
1
static/cf4686f6f3a84cd39daaf8ca93e58448.txt
Normal file
@@ -0,0 +1 @@
|
||||
cf4686f6f3a84cd39daaf8ca93e58448
|
||||
Reference in New Issue
Block a user