api-node/Dockerfile.development
FROM docker.io/node:22.9.0-alpine AS web-base
WORKDIR /usr/src/app
FROM web-base AS web-builder
COPY ["web/package.json", "web/package-lock.json", "web/.npmrc", "./"]
RUN npm ci
# https://create-react-app.dev/docs/adding-custom-environment-variables/
# In create-react-app, when you run 'npm run build' to make a production bundle, it is always equal to 'production'.
# So using REACT_APP_SERVER_WS_PROTOCOL=ws in .env.production.local.example for development
COPY web/.env.production.local.example ./.env.production.local
COPY web ./
# Skip lint check during react-scripts build
RUN rm -f ./.eslintrc.js \
&& npm run build
FROM docker.io/node:22.9.0-alpine AS api-node-base
WORKDIR /usr/src/app
FROM api-node-base AS api-node-builder
COPY ["api-node/package.json", "api-node/package-lock.json", "api-node/.npmrc", "./"]
RUN npm ci
COPY --from=web-builder /usr/src/app/build ./public
COPY api-node ./
EXPOSE 5000
CMD ["npm", "run", "dev"]