Files
Memento/Dockerfile

55 lines
1.1 KiB
Docker

# Build stage
FROM node:22-alpine AS builder
WORKDIR /app
# Copy package files
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
# Install pnpm
RUN npm install -g pnpm
# Install all dependencies (including dev)
RUN pnpm install --frozen-lockfile
# Copy source code
COPY . .
# Build the application
RUN pnpm run build
# Production stage
FROM node:22-alpine
WORKDIR /app
# Copy package files from builder
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
# Install pnpm
RUN npm install -g pnpm
# Install all dependencies (including dev for drizzle-kit)
RUN pnpm install --frozen-lockfile
# Copy built application from builder
COPY --from=builder /app/build ./build
# Copy drizzle config and schema for migrations
COPY drizzle.config.ts ./
COPY tsconfig.json ./
COPY src/lib/server/db ./src/lib/server/db
# Install netcat for database readiness check
RUN apk add --no-cache netcat-openbsd
# Copy entrypoint script
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
# Expose port (SvelteKit Node adapter default)
EXPOSE 5173
# Start the application
ENTRYPOINT ["/app/entrypoint.sh"]