37 lines
720 B
Docker
37 lines
720 B
Docker
# Build stage
|
|
FROM node:20-slim AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install openssl for Prisma
|
|
RUN apt-get update && apt-get install -y openssl && rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY package*.json ./
|
|
COPY prisma ./prisma/
|
|
|
|
RUN npm install
|
|
RUN npx prisma generate
|
|
|
|
COPY . .
|
|
|
|
# In this specific project, we run via tsx directly
|
|
# If a build step is added later, it should happen here
|
|
|
|
# Production stage
|
|
FROM node:20-slim
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update && apt-get install -y openssl && rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
COPY --from=builder /app/prisma ./prisma
|
|
COPY . .
|
|
|
|
# Ensure data directory exists for SQLite
|
|
RUN mkdir -p /app/data
|
|
|
|
EXPOSE 3001
|
|
|
|
CMD ["npx", "tsx", "index.ts"]
|