hf-fast / Dockerfile
hlarcher's picture
hlarcher HF Staff
feat: add @sveltejs/adapter-node to package.json and update svelte.config.js + Dockerfile
22ddeb7 unverified
raw
history blame contribute delete
904 Bytes
# Stage 1: Build the application
FROM node:22-alpine AS builder
WORKDIR /app
# Copy package files and install dependencies
COPY package*.json ./
RUN npm ci
# Copy application source
COPY . .
# Build the application
RUN npm run build
# Stage 2: Run the application
FROM node:22-alpine AS production
WORKDIR /app
# Set to production environment
ENV NODE_ENV=production
# Copy only the necessary files from the builder stage
COPY --from=builder /app/build ./build
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/package-lock.json ./package-lock.json
# Install only production dependencies
RUN npm ci --omit=dev
# Create a non-root user and switch to it
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001 -G nodejs
USER nodejs
# Expose the port the app will run on
EXPOSE 3000
# Define the command to run the application
CMD ["node", "build/index.js"]