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

Please provide official docker image

Open surajbarkale opened this issue 4 years ago • 30 comments

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.

surajbarkale avatar Sep 05 '19 00:09 surajbarkale

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 avatar Sep 05 '19 00:09 samtstern

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

samtstern avatar Sep 05 '19 18:09 samtstern

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

surajbarkale avatar Sep 06 '19 00:09 surajbarkale

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

samtstern avatar Sep 06 '19 04:09 samtstern

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

surajbarkale avatar Sep 06 '19 05:09 surajbarkale

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

samtstern avatar Sep 06 '19 15:09 samtstern

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

beshkenadze avatar Oct 07 '19 14:10 beshkenadze

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

bpetetot avatar Jul 28 '20 12:07 bpetetot

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

mbleigh avatar Jul 28 '20 16:07 mbleigh

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

audkar avatar Aug 25 '20 09:08 audkar

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

blueyetisoftware-jason avatar Sep 07 '20 03:09 blueyetisoftware-jason

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

  • https://github.com/ridedott/firestore-emulator-docker
  • https://github.com/ridedott/pubsub-emulator-docker

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

merlinnot avatar Sep 08 '20 08:09 merlinnot

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

akauppi avatar Jul 18 '21 19:07 akauppi

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

SmashingQuasar avatar Apr 08 '23 12:04 SmashingQuasar

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.

christhompsongoogle avatar Apr 11 '23 20:04 christhompsongoogle

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.

SmashingQuasar avatar Apr 11 '23 21:04 SmashingQuasar

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

steren avatar Jul 06 '23 17:07 steren

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

joehan avatar Jul 11 '23 17:07 joehan

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

SmashingQuasar avatar Aug 30 '23 14:08 SmashingQuasar

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

SeanFeldman avatar Dec 23 '23 16:12 SeanFeldman

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.

SmashingQuasar avatar Dec 24 '23 13:12 SmashingQuasar

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

SeanFeldman avatar Dec 24 '23 15:12 SeanFeldman

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!

joehan avatar Dec 26 '23 18:12 joehan

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

SeanFeldman avatar Dec 26 '23 19:12 SeanFeldman

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

joehan avatar Dec 26 '23 19:12 joehan

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

SeanFeldman avatar Jan 09 '24 20:01 SeanFeldman

@joehan could you provide an update? Thank you.

SeanFeldman avatar Jan 22 '24 05:01 SeanFeldman

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

eddumelendez avatar Feb 06 '24 15:02 eddumelendez

@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 🙂

SeanFeldman avatar Feb 07 '24 05:02 SeanFeldman