docker – Nginx Dockerfile unable to find dist folder in MERN app
I have a mern app. I created the frontend using react with vite. It’s build directory is supposed to be “frontend/dist”. I have dockerfiles for nginx, the frontend and backend. I’m using docker compose to start all the containers. When i dockercompose up i get the error:
failed to solve: failed to compute cache key: failed to calculate checksum of ref 4e2eb982-6e1e-4ac6-8a65-72f7ab5160df::sl9uqn95azj1lt7jxf22ooe94: "/rehaish_frontend/dist": not found
I have tried relative and absolute paths
I tried to build the frontend before using docker compose up
The nginx dockerfile just cannot seem to find the directory
This is my nginx dockerfile:
`FROM nginx:alpine
COPY nginx.conf /etc/nginx/nginx.conf
COPY ../rehaish_frontend/dist /usr/share/nginx/html
EXPOSE 80
CMD [“nginx”, “-g”, “daemon off;”]
`
Read more here: Source link
