Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
demostenes1509 opened this issue Jun 11, 2021 · 7 comments
Open

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

demostenes1509 opened this issue Jun 11, 2021 · 7 comments

Comments

@demostenes1509
Copy link

demostenes1509 commented Jun 11, 2021

...
...
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

@Skiba-Tomasz
Copy link

Skiba-Tomasz commented Sep 12, 2021

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

@wf9a5m75
Copy link

wf9a5m75 commented Jan 4, 2023

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
Copy link

wf9a5m75 commented Jan 4, 2023

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.

@nstanard
Copy link

nstanard commented Jan 11, 2023

------------------------ 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?

@giladv
Copy link

giladv commented Jan 21, 2023

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

@nstanard
Copy link

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

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

@giladv
Copy link

giladv commented Jan 21, 2023

@nstanard thanks! trying right now

edit: worked! thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants