The issue I have is already asked here : How to use vue.js with Nginx? but trying the solutions didn't solve my problem.
So when I build my Dockerfile and go to localhost:8080 for example it works (reloading the page works too). When I navigate to a different page, let's say localhost:8080/add_app it shows the page the first time. But when I reload I'm getting an error:
Error in docker desktop:
This is mine Dockerfile:
# build stage
FROM node:lts-alpine as build-stage
WORKDIR /app
COPY ./platform-frontend/package*.json ./
RUN npm install
COPY ./platform-frontend .
RUN npm run build
# production stage
FROM nginx:stable-alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
COPY --from=build-stage /app/nginx/nginx.conf /etc/nginx/conf.d/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
This is mine nginx.conf file :
server {
listen 80;
server_name localhost;
location / {
root /app/dist;
index index.html index.html;
try_files $uri /index.html;
}
}
My project structure:


