2

I have a vuejs application with @akryum/ssr

While doing

npm run ssr:serve

or

npm run ssr:start

everything works as it should. But when I try to use docker:

version: '3.7'

services:
  npm:
    build:
      context: ./
    ports:
      - "8080:8080"
    volumes:
      - ./:/var/www/html

Dockerfile

FROM node:14.0.0

WORKDIR /var/www/html

EXPOSE 8080

CMD ["npm", "run", "serve"]

Only the option without ssr works: npm run serve

Using

CMD ["npm", "run", "ssr:start"]

i open http://localhost:8080/ and get error

ERR_CONNECTION_RESET

In my package.json

  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "ssr:build": "vue-cli-service ssr:build",
    "ssr:serve": "vue-cli-service ssr:serve",
    "ssr:start": "PORT=8080 cross-env NODE_ENV=production vue-cli-service ssr:serve --mode production"
  },

On startup I see

npm_1  | [16:36:39] Server listening on localhost:8080

means the ports are correct

1 Answer 1

2

I found a solution!

Added --host '0.0.0.0' in package.json

"ssr:start": "cross-env NODE_ENV=production vue-cli-service ssr:serve --mode production --host '0.0.0.0' --port 8080"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.