lofi / Dockerfile
veltrixcode's picture
Update Dockerfile
c95ede1 verified
Raw History Blame Contribute Delete
874 Bytes
# Use a Node.js Slim image for the builder stage
FROM node:24.0.1-slim AS builder
# Set the working directory
WORKDIR /app
# Copy package files and install dependencies
COPY package*.json ./
RUN npm ci
# Copy the rest of the source files and build the SvelteKit app
COPY . .
RUN npm run build
# Prune dependencies to production-only
RUN npm prune --production
# Use another Node.js Slim image for the final stage
FROM node:24.0.1-slim AS runner
# Set the working directory
WORKDIR /app
# Copy the built app and production node_modules from the builder stage
COPY --from=builder /app/build build/
COPY --from=builder /app/node_modules node_modules/
COPY package.json .
# Expose the port the app runs on
EXPOSE 7860
# Set the environment to production
ENV NODE_ENV=production
ENV PORT=7860
ENV HOST=0.0.0.0
# Specify the command to run the app
CMD ["node", "build"]