Currently having an issue when running an nginx server through docker. I do something similar to this sample file in which I run yarn build and go to its directory and copy it over to /usr/share/nginx/html
FROM base_image AS builder
USER root
RUN mkdir -p /fizz/buzz/bizz/web
RUN chown -R usr:usr /fizz/buzz/bizz/
COPY reactui/ /fizz/buzz/bizz/web/reactui
COPY build_react.sh /fizz/buzz/bizz/web
WORKDIR "/fizz/buzz/bizz/web/reactui"
RUN yarn build
FROM nginx
COPY --from=builder /fizz/buzz/bizz/web/reactui/build /usr/share/nginx/html
The docker is built as intended however when running the docker via port 80 I receive the following error message.
The command I run to run the container is this:
docker run -p 8080:80 -v /usr/share/nginx/html/ test_nine
"GET /web/static/css/main.a2b40c63.css HTTP/1.1" 404 555 "http://localhost:8080/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36 3 [error] 41#41: *12 open() "/usr/share/nginx/html/web/static/css/main.a2b40c63.css" failed (2: No such file or directory), server: localhost, request: "GET /web/static/css/main.a2b40c63.css HTTP/1.1", host: "localhost:8080", referrer: "http://localhost:8080/"
For some reason this server cannot grab the CSS and JS files in the static/ folder of the production build. What could be the issue?