I have a multi staging Dockerfile that works great in development, but when I'm trying to deploy for production the build folder stays empty. I can't see where it goes wrong, should work to me. Here is the Dockerfile :
ARG NODE_VERSION=13
ARG NGINX_VERSION=1.17
# "development" stage
FROM node:${NODE_VERSION}-alpine AS api_platform_client_common
EXPOSE 3000
WORKDIR /usr/src/client
RUN yarn global add @api-platform/client-generator
RUN apk --no-cache --virtual build-dependencies add \
python \
make \
build-base
# prevent the reinstallation of node modules at every changes in the source code
COPY package.json yarn.lock ./
RUN set -eux; \
yarn install
COPY . ./
VOLUME /usr/src/client/node_modules
#ENV HTTPS true
FROM api_platform_client_common AS api_platform_client_development
CMD ["yarn", "dev"]
# "build" stage
# depends on the "development" stage above
FROM api_platform_client_common AS api_platform_client_build
WORKDIR /usr/src/client
ARG REACT_APP_API_ENTRYPOINT
ENV NODE_ENV production
RUN set -eux; \
npm run build
#yarn build
RUN npm install -g serve
CMD serve -s build -l 3000
Is part of a more complex docker-compose setup, but I don't think that the rest of files are relevant. When the build steps occurs, I have the logs saying it has been generated :
File sizes after gzip:
914.33 KB build/static/js/2.fb074eef.chunk.js
25.57 KB build/static/js/main.2c9c53c7.chunk.js
23.82 KB build/static/css/main.581e45d5.chunk.css
12.56 KB build/static/css/2.5dd93f16.chunk.css
773 B build/static/js/runtime-main.09b85ec0.js
The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.
But when I visit the served content by npm serve, I just get "Files within build /" with blank window. When I run "ls /usr/src/client/build" in my docker container, it's in fact empty...
Can someone see what's wrong ?
Thanks !