# Сборка из корня: docker build -t gooseek/auth-svc:latest -f services/auth-svc/Dockerfile .
FROM node:22-alpine AS builder
WORKDIR /app
COPY package.json package-lock.json ./
COPY services/auth-svc/package.json ./services/auth-svc/
RUN npm ci -w auth-svc
COPY services/auth-svc/tsconfig.json ./services/auth-svc/
COPY services/auth-svc/src ./services/auth-svc/src
WORKDIR /app/services/auth-svc
RUN npm run build

FROM node:22-alpine
WORKDIR /app
COPY package.json package-lock.json ./
COPY services/auth-svc/package.json ./services/auth-svc/
RUN npm ci -w auth-svc --omit=dev
COPY --from=builder /app/services/auth-svc/dist ./services/auth-svc/dist
WORKDIR /app/services/auth-svc
EXPOSE 3014
ENV PORT=3014
CMD ["node", "dist/index.js"]
