# Builder stage
FROM node:16-alpine AS builder
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --production --frozen-lockfile
COPY . .
RUN yarn build

# Runtime stage
FROM node:16-alpine
WORKDIR /app
COPY --from=builder /app/build ./build
RUN yarn global add serve
ENV PORT=3000
EXPOSE 3000
CMD ["sh", "-c", "serve -s build -l ${PORT}"]
