# syntax=docker/dockerfile:1.4 FROM node:18-alpine AS development WORKDIR /app # Install build dependencies RUN apk add --no-cache python make g++ \ && apk add vips-dev fftw-dev build-base \ --update-cache \ --repository https://alpine.global.ssl.fastly.net/alpine/v3.10/community \ --repository https://alpine.global.ssl.fastly.net/alpine/v3.10/main \ && rm -fR /var/cache/apk/* # Copy package files COPY package.json package-lock.json ./ # Install dependencies RUN npm ci --legacy-peer-deps # Copy source code COPY . . ENV CI=true ENV PORT=3000 CMD ["npm", "start"] # Build stage FROM development AS build RUN npm run build # Production stage FROM nginx:alpine AS production WORKDIR /usr/share/nginx/html # Remove default nginx files RUN rm -rf ./* # Copy built app COPY --from=build /app/build . # Copy nginx config if it exists COPY .nginx/nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 ENTRYPOINT ["nginx", "-g", "daemon off;"]