Vue build breaks in Docker

Viewed 24

When building production (npm run build) of my vue.js project - everything works fine locally when I'm simply opening .html file

When building it with nginx for production - something goes wrong and only one page stops working.enter image description here

I've tried two different Dockerfiles but result is the same

FROM node:lts-alpine as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build

# production stage
FROM nginx:stable-alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
1 Answers

Your Nginx server is probably routing the static JS/CSS files to the HTML folder instead of routing them to the static folder. Check the content of the JS files. Is it what you expect or is it something different?

Related