32 lines
619 B
Docker
32 lines
619 B
Docker
# 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"]
|