chore: Dockerize method
This commit is contained in:
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"]
|
||||
Reference in New Issue
Block a user