FROM node:20-alpine

RUN apk add --no-cache nginx

COPY nginx.conf /etc/nginx/nginx.conf

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

RUN npm run build

EXPOSE 80

CMD ["sh", "-c", "nginx -g 'daemon off;' & npm run start:all"]