firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.02k stars 938 forks source link

Please provide official docker image #1644

Open surajbarkale opened 5 years ago

surajbarkale commented 5 years ago

There is already a linux binary published with every release. It would greatly simplify our workflow if a docker image is also published with the release. Most of the CI systems are now using Docker for specifying tool versions and not having oficial firebase-tools image is causing extra work.

samtstern commented 5 years ago

We were hoping that the standalone CLI would make it very easy to include Firebase in your existing Docker image.

Just curious what would you expect the environment in the Docker image to be like? Just enough to run Firebase commands or enough to also run your unit tests, etc?

samtstern commented 5 years ago

@mbleigh I think you meant to comment that on #1645

surajbarkale commented 5 years ago

@samtstern I am expecting an image that is enough to run firebase commands. It is easier to use it as base image in case we need to extend it. We are trying appdistribution in one of the internal apps and creating a separate docker image is just duplicate work.

samtstern commented 5 years ago

@surajbarkale so maybe something like Debian + the Firebase CLI? Or would you want more/less than that?

surajbarkale commented 5 years ago

Either debian + cli or scratch + cli image is OK.

samtstern commented 5 years ago

@surajbarkale thanks for all the feedback. I put this on our feature request list, it ties in nicely to some things we want to do around supporting CI systems so I do think we will do this eventually.

beshkenadze commented 5 years ago

I really want to have a docker image for github actions. It will help to use Firebase Hosting with GitHub Builds Tools.

bpetetot commented 4 years ago

I really want to have a docker image for github actions. It will help to use Firebase Hosting with GitHub Builds Tools.

For my project I'm using firebase-action and it works very well.

And If you only need a Docker image, check the project dockerfile : https://github.com/w9jds/firebase-action/blob/master/Dockerfile

mbleigh commented 4 years ago

@abeisgoat you mentioned having some interest in tackling this for Cloud Build, would be nice to tackle it for GH Actions as well.

audkar commented 4 years ago

Most CI servers supports Service containers. This would be ideal use-case for firebase emulators. In such case our tests containers could avoid downloading firebase-tools

blueyetisoftware-jason commented 4 years ago

Firebase on alpine would work perfect for our uses cases. We keep our images super small

merlinnot commented 4 years ago

For anyone looking for a quick solution for Firestore and PubSub, Dott maintains two containers:

It's hosted on GitHub Packages and Docker Hub. We'd be willing to transfer these repositories to Google 😇

akauppi commented 3 years ago

@surajbarkale @samtstern @phinatic

I am expecting an image that is enough to run firebase commands. It is easier to use it as base image in case we need to extend it.

I needed this for Cloud Build, and wanted as slim an image as possible. Would like to invite you to have a look at firebase-ci-builder. It's 461MB, and geared towards easy customisation, as Suraj requested.

SmashingQuasar commented 1 year ago

👋 I am reacting to this old but still opened issue to share my recent experience. We are working on a fully dockerized environment for development. For this reason we needed to dockerize the emulator suite and it has proven to be a lot harder than it needs to be. I eventually worked it out and we now have a working debian-bullseye based Docker image.

I think one of the most problematic aspect of the emulator suite is the way the services are exposed. When working with a rudimentary Docker setting it works fine. However adding a reverse-proxy (Traefik in our case but Nginx would create the same problem), things become hard. This is because the emulator suite behaves strangely regarding HTTP and HTTPS. Currently everything works except the emulator hub that still refuses to answer external requests.

I would be glad to help you create an official Docker image for this emulator suite, however I think adding an HTTPS option would make things significantly easier. In any case, if you need a working image that is reverse-proxy compatible, let me know where I can open a PR and what kind of requirements you would need. I can only create Debian images since Alpine adds to the already difficult setup. We would also need to make persistence a lot easier because the exports are currently not playing nice. Mounting a dynamic volume seems like the only viable option for persistence right now and this would require the Firebase emulation suite to store things outside of it's own memory.

christhompsongoogle commented 1 year ago

Thanks for your interest SmashingQuasar. This is an obviously beneficial improvement to the Emulator Suite but the team doesn't have time to dive in just yet. If you're willing to take the lead here I'd be happy to discuss any details and possibly work together on a solution.

SmashingQuasar commented 1 year ago

Thanks for your interest SmashingQuasar. This is an obviously beneficial improvement to the Emulator Suite but the team doesn't have time to dive in just yet. If you're willing to take the lead here I'd be happy to discuss any details and possibly work together on a solution.

Sure, I can probably provide a solid basis for the Docker image. I built a custom image for our own needs, so right now it only handles auth, ui and firestore but it shouldn't be too difficult to expose the other services. My concern is about data persistence. I had to rely on setting up a cronjob within the container to export the data every 5 minutes. This is because Firebase does not react to the SIGINT sent by Docker and thus never trigger the --export-on-exit option. If you have any idea on how to improve this and make persistence stable I'll be glad to open a PR with everything you need to get a working Dockerfile. It will obviously take a bit of time to work it out depending on my work schedule but I'm totally willing to do this.

steren commented 1 year ago

I am also looking at an official firebase container image on DockerHub (e.g. https://hub.docker.com/r/google/firebase)

I would expect docker run google/firebase to act exactly like a locally installed firebase command.

The use case is CI, notably Google Cloud Build: I want to deploy my Firebase Hosting app in the same cloudbuild.yaml as I deploy to Cloud Run:

 steps:
 - name: 'gcr.io/cloud-builders/docker'
   args: ['build', '-t', 'gcr.io/$PROJECT_ID/SERVICE-NAME:$COMMIT_SHA', '.']
 - name: 'gcr.io/cloud-builders/docker'
   args: ['push', 'gcr.io/$PROJECT_ID/SERVICE-NAME:$COMMIT_SHA']
 - name: 'google/firebase'
   args: ['deploy' ...] 
 - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
   entrypoint: gcloud
   args:
   - 'run'
   - 'deploy'
   - 'SERVICE-NAME'
   - '--image'
   - 'gcr.io/$PROJECT_ID/SERVICE-NAME:$COMMIT_SHA'
   - '--region'
   - 'REGION'

Instead, the current official instructions are telling me how to build that firebase image using a community repo

joehan commented 1 year ago

Hey all, I've kicked off work on this in https://github.com/firebase/firebase-tools/pull/6094. For Google folks, doc for the process to release this are at go/firebase-tools-docker

SmashingQuasar commented 1 year ago

@joehan I see that the #6094 PR was merged but I do not see any information on the documentation about the official docker image. Would you mind providing some information about the current status of the image please?

SeanFeldman commented 10 months ago

It looks like PR #6255 to add the image is stalled. @joehan, is that going to be resumed anytime soon?

SmashingQuasar commented 10 months ago

It looks like PR #6255 to add the image is stalled. @joehan, is that going to be resumed anytime soon?

If needed, I built a working image so I can open a PR if the author is not active.

SeanFeldman commented 10 months ago

@SmashingQuasar, that'd be good if the original PR is abandoned. Also, would help to involve someone from GCP to coordinate this and ensure documentation gets updated.

joehan commented 10 months ago

Hey @SmashingQuasar and @SeanFeldman - turns out we have some internal processes for approving Docker images before we release them (to ensure that they don't have any major license or security issues). This work was held up on the last step but is hopefully going to land sometime very soon. I've got a docs update pending and ready to go once this is released.

Sorry for the delay on this all!

SeanFeldman commented 10 months ago

@joehan no worries. Any chance you could share documentation PR to peek at?

Having an official Docker image built with every NPM package release will be great to remove this responsibility from individual teams dockerizing emulators usage. Any rough ETA on when this could be available?

joehan commented 10 months ago

The docs aren't source controlled on a public GitHub repo, so I won't be able to share yet, unfortunately.

SeanFeldman commented 10 months ago

@joehan, could you share the plans for PR #6255 or the status of this issue to have an idea of what to expect?

SeanFeldman commented 9 months ago

@joehan could you provide an update? Thank you.

eddumelendez commented 9 months ago

Hi, in the past there was a similar request for google cloud emulators and the team built an specific image for those. See https://github.com/GoogleCloudPlatform/cloud-sdk-docker/issues/202#issuecomment-714708537. The main use case is to use those images directly, with no installation steps, to run the services for integration tests purposes using Testcontainers. It would be nice to have an official Firebase image to improve DevEx for all Firebase users.

I see there is already a Dockerfile but missing the publish process to Docker Hub and GCR

SeanFeldman commented 9 months ago

@eddumelendez, I think the emulators you're referring to do not include Firebase tools (this repo). You're correct. The image needs to be published under the official registry but Google is being... Google 🙂

SmashingQuasar commented 5 months ago

Any news on that issue? I'm still willing to provide my own Dockerfile but this would require the maintainers to review and merge the PR.