Vuejs container application does not render?

Asked

Viewed 79 times

-1

So, I made a container of a Vuejs application and it goes up without problem, but when accessing localhost:8080, this appears:

inserir a descrição da imagem aqui

Follow the dockerfile:

FROM node:lts-alpine

# install simple http server for serving static content
RUN npm install -g http-server

# make the 'app' folder the current working directory
WORKDIR /app

# copy both 'package.json' and 'package-lock.json' (if available)
COPY package*.json ./

# install project dependencies
RUN npm install

# copy project files and folders to the current working directory (i.e. 'app' folder)
COPY . .

# build app for production with minification
RUN npm run build

EXPOSE 8080
CMD [ "http-server", "dist" ]

If I use "npm run dev" to test, the application goes up normal, but in the container of it. Any idea what it might be?

  • Your server is up, but it’s missing an index.html to open it

  • Hello, thanks for the answer. I have an index.html at the root of the project, follow index: <! DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Alurapic</title> </head> <body> <div id="app"></div> <script src="/dist/build.js"></script> </body> </html>

1 answer

0

Well, I couldn’t run directly through the Vue container, so I created a container of nodejs and pasted index.html and the dist folder of the Vue application inside the public folder of the server and it worked better than nothing.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.