Running netlify-cli on mac inside a docker container

Site: Vue Netlify Fauna

I’m following the example from Build a serverless CRUD app with authentication using Vue.js Netlify and FaunaDB - DEV Community 👩‍💻👨‍💻 and successfully deployed the example by using the button on the webpage.

I am now attempting to run this locally. My macbook is set up so that all the development resources are run through docker. That is, I do not have “node” on the mac, I start a docker instance to do development. This is generally working for other projects when I do “npm run serve”, for example.

On this project, however, I get the following:

much webpack output....

  App running at:
  - Local:   http://localhost:8080/ 

  It seems you are running Vue CLI inside a container.
  Access the dev server via http://localhost:<your container's external mapped port>/

  Note that the development build is not optimized.
  To create a production build, run npm run build.

so, that looks normal and like all my other vue projects. However, the port is not working and dots keep printing to the terminal like it is still doing something:

  Note that the development build is not optimized.
  To create a production build, run npm run build.

............................................

And they will continue to print until I ctrl-C.

I’m guessing that there is either a login step I’m missing or a port that needs to be opened up but I’m not sure where to look.

Here are my docker files:

# Dockerfile
FROM node:14.11.0

RUN mkdir /srv/app && chown node:node /srv/app

# TODO-PER: There are known build problems using the latest version.
RUN npm install netlify-cli@2.45 -g

USER node

WORKDIR /srv/app
#docker-compose.yml
version: '3.7'

services:
  app:
    image: fauna-starter
    build: .
    environment:
      - "CMD=${CMD}"
      - "FAUNADB_SERVER_SECRET=${FAUNADB_SERVER_SECRET}"
    container_name: fauna-starter
    command: npm ${CMD}
    volumes:
      - .:/srv/app
      - ./node_modules:/srv/app/node_modules
    ports:
        - "8080:8080"

And I’m starting it with:

 CMD="" FAUNADB_SERVER_SECRET=my-secret docker-compose run --rm app sh

Then in the container:

npm install
npm start

Thanks for any suggestions.

Update: I tried this on another computer that does have development tools locally. The same thing happens when I type npm start. localhost:8080 isn’t connected and a series of dots keep printing.

So it has nothing to do with docker.

Update:
I managed to get the dev server running without FaunaDB or netlify-cli So I know I have a connection to port 8080.

I added the ports 3000 and 34567 to pass through because I see references to them in netlify.toml.

I then tried the following:

FAUNADB_SERVER_SECRET=my-secret
export FAUNADB_SERVER_SECRET   
FAUNADB_SERVER_SECRET=$FAUNADB_SERVER_SECRET npm run start

That gives the output:

Recreating fauna-starter ... done
Attaching to fauna-starter
fauna-starter | 
fauna-starter | > simple-vue-netlify-auth@0.1.0 start /srv/app
fauna-starter | > netlify dev
fauna-starter | 
fauna-starter | ◈ Netlify Dev ◈
fauna-starter | ◈ Starting Netlify Dev with vue-cli
fauna-starter | Waiting for localhost:3000.
fauna-starter | ◈ Functions server is listening on 34567
fauna-starter | /usr/local/lib/node_modules/netlify-cli/node_modules/netlify-redirector/lib/redirects.js:116
fauna-starter |       throw ex;
fauna-starter |       ^
fauna-starter | 
fauna-starter | TypeError: dest.end is not a function
fauna-starter |     at ReadStream.onend (_stream_readable.js:682:10)
fauna-starter |     at Object.onceWrapper (events.js:420:28)
fauna-starter |     at ReadStream.emit (events.js:326:22)
fauna-starter |     at endReadableNT (_stream_readable.js:1252:12)
fauna-starter |     at processTicksAndRejections (internal/process/task_queues.js:80:21)

Update:

I got something to work, but I’m not sure what’s going on. The example project has the command in package.json:

    "serve": "npm run bootstrap-db && vue-cli-service serve",

That gave the above problems. However, breaking those commands up seemed to work. the npm run bootstrap-db only needs to run once. The dev server will work and actually update FaunaDB if I just run vue-cli-service serve without using netlify dev.

I’m still trying to understand what’s going on, but at least I’m not stuck.

Hi @paulrosen,

One thing that may be happening is a loop. Perhaps the npm run bootstrap-db changes some files where the command vue-cli-service serve is watching for changes. This could cause the command to continually re-run. Does that sound plausible?