FROM node:16-alpine AS builder

RUN apk add --no-cache libc6-compat

WORKDIR /app

COPY package.json .
COPY pnpm-lock.yaml .

RUN npm install -g pnpm && \
    pnpm install sharp && \
    pnpm install

COPY . .

RUN npm run build

ENV NODE_ENV=production

EXPOSE 3000

ENV PORT 3000

CMD ["pnpm", "start"]

# FROM node:16-alpine AS builder

# RUN apk add --no-cache libc6-compat

# WORKDIR /app

# COPY package.json .
# COPY pnpm-lock.yaml .

# ENV NODE_ENV=production \
#     PORT=3000

# RUN npm install -g pnpm && \
#     pnpm install

# COPY . .

# RUN npm build

# EXPOSE 3000

# CMD ["pnpm", "start"]