firebase-tools-docker icon indicating copy to clipboard operation
firebase-tools-docker copied to clipboard

Add docker-compose.yml example file on your proyect.

Open demostenes1509 opened this issue 3 years ago • 7 comments

... ... firebase: container_name: firebase image: andreysenov/firebase-tools user: node # command: firebase emulators:start command: tail -f /dev/null ports: - 9005:9005 - 9099:9099 - 9199:9199 - 5001:5001 - 5000:5000 - 8080:8080 - 8085:8085 - 9000:9000 - 3003:3003 volumes: - irebase-volume:/home/node ... ... ...

In order to configure it, user should:

  1. Enter to image and run firebase login
  2. firebase init
  3. Modify firebase.json
  4. Comment tail command and uncomment firebase emulators:start command

My congrats to your work

demostenes1509 avatar Jun 11 '21 13:06 demostenes1509

Thank you. This was helpful for me. Could you explain why container exits if I do not provide command: tail -f /dev/null in docker-compose?

Also please note that in order to setup firebase user has to be set to root

Skiba-Tomasz avatar Sep 12 '21 13:09 Skiba-Tomasz

Thanks @demostenes1509 !

Following him up:

  1. create a docker-compose.yml file.
version: '3'
services:
  app:
    container_name: firebase
    image: andreysenov/firebase-tools
    user: node
    #command: firebase emulators:start
    command: tail -f /dev/null
    ports:
      - 4000:4000
      - 5000:5000
      - 5001:5001
      - 8080:8080
      - 8085:8085
      - 9000:9000
      - 9005:9005
      - 9099:9099
      - 9199:9199
    volumes:
      - ./app_dir:/home/node
volumes:
  app_dir:

  1. then run docker compose up.
  2. The emulator should start (access to http://localhost:4000)

Could you explain why container exits if I do not provide command: tail -f /dev/null in docker-compose?

If so, the docker exits the container. To prevent exiting the image, he just specify tail -f /dev/null. If you want to see the emulator outputs, use firebase emulators:start.

please note that in order to setup firebase user has to be set to root

Yes, root user is necessary, and it specified in your Dockerfile. user: node is running user.

wf9a5m75 avatar Jan 04 '23 06:01 wf9a5m75

To authenticate firebase, open another terminal window, then

$ docker exec -it firebase
(image id):~$ firebase login
Visit this URL on this device to log in:
https://accounts.google.com/o/oauth2/auth?client_id=...

Copy the above URL, and open on your browser, and authenticate the firebase.

After that, the firebase tools recognize successful automatically.

wf9a5m75 avatar Jan 04 '23 06:01 wf9a5m75

------------------------ Fix / Update ------------------------ Update: I had to set user: root in the docker-compose and it worked + my go tests passed using the emulator.

🎊 🚀

------------------------ Original ------------------------

Hello 👋 I have a docker-compose file very similar to the one described in this thread and I'm trying to run it in a github action. I am running into an error that I can't seem to figure out though.

EACCES: permission denied, mkdir '/home/node/.config/configstore'

Full github action / output:

name: Go package

on: [push]

jobs:
  test:

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - name: Start Firebase
        run: docker-compose -f test/docker-compose.yml run firebase
Creating network "test_test-net" with driver "bridge"
Creating volume "test_go-mod" with default driver
Creating volume "test_go-build" with default driver
Pulling firebase (andreysenov/firebase-tools:11.13.0)...
11.13.0: Pulling from andreysenov/firebase-tools
Digest: sha256:e7f39d6d36160be27f102eac12b8a12aef0ca7cb779bd78319d1f113293fa234
Status: Downloaded newer image for andreysenov/firebase-tools:11.13.0
Creating test_firebase_run ... 
Creating test_firebase_run ... done
┌────────────────────────────────────────────────────────┐
│           firebase-tools update check failed           │
│          Try running with sudo or get access           │
│          to the local update config store via          │
│ sudo chown -R $USER:$(id -gn $USER) /home/node/.config │
└────────────────────────────────────────────────────────┘
/usr/local/share/.config/yarn/global/node_modules/configstore/index.js:68
			throw error;
			^

Error: EACCES: permission denied, mkdir '/home/node/.config/configstore'
You don't have access to this file.

    at Object.mkdirSync (node:fs:1386:3)
    at AsyncFunction.module.exports.sync (/usr/local/share/.config/yarn/global/node_modules/make-dir/index.js:1[14](https://github.com/theroutingcompany/usermanager/actions/runs/3895231000/jobs/6650282334#step:4:15):6)
    at Configstore.set all [as all] (/usr/local/share/.config/yarn/global/node_modules/configstore/index.js:59:12)
    at Configstore.set (/usr/local/share/.config/yarn/global/node_modules/configstore/index.js:91:12)
    at Object.<anonymous> (/usr/local/share/.config/yarn/global/node_modules/firebase-tools/lib/track.js:20:31)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1[18](https://github.com/theroutingcompany/usermanager/actions/runs/3895231000/jobs/6650282334#step:4:19)0:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Module.require (node:internal/modules/cjs/loader:1028:[19](https://github.com/theroutingcompany/usermanager/actions/runs/3895231000/jobs/6650282334#step:4:20)) {
  errno: -13,
  syscall: 'mkdir',
  code: 'EACCES',
  path: '/home/node/.config/configstore'
}
1
Error: Process completed with exit code 1.

Any ideas/suggestions?

nstanard avatar Jan 11 '23 17:01 nstanard

@nstanard still getting the same issue even after setting user: node

giladv avatar Jan 21 '23 13:01 giladv

@nstanard still getting the same issue even after setting user: node

Oops, sorry. I meant to type "user: root". I updated my comment.

nstanard avatar Jan 21 '23 13:01 nstanard

@nstanard thanks! trying right now

edit: worked! thanks!

giladv avatar Jan 21 '23 13:01 giladv