# ---- Base Image ----
FROM node:18-alpine AS base
WORKDIR /app
# ---- Dependencies ----
FROM base AS dependencies
COPY package*.json ./
RUN npm install
# ---- Build ----
FROM dependencies AS build
COPY . .
RUN npm run build
# ---- Production ----
FROM base AS production
ENV NODE_ENV=production
COPY package*.json ./
RUN npm install --omit=dev
COPY --from=build /app/dist ./dist
EXPOSE 8081
CMD ["node", "dist/index.js", "--http"]