FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
COPY scripts/ ./scripts/
RUN npm install
COPY tsconfig.json ./
COPY src/ ./src/
RUN npx tsc

FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
COPY scripts/ ./scripts/
RUN npm install --omit=dev
COPY --from=builder /app/dist ./dist
EXPOSE 3456
CMD ["node", "dist/index.js"]
