I'm building a python docker image and I need to use the firebase CLI (accessed via os.system commands) in my app. I'm trying to install it by running this in the dockerfile:
FROM python:3.6.8
RUN curl -sL https://firebase.tools | bash
Getting this output from docker build -t my_image/firebase
:
Sending build context to Docker daemon 2.048kB
Step 1/2 : FROM python:3.6.8
---> 48c06762acf0
Step 2/2 : RUN curl -sL https://firebase.tools | bash
---> Running in 11536da1cdb4
-- Checking for existing firebase-tools on PATH...
-- Checking your machine type...
-- Links...
[Binary URL] https://firebase.tools/bin/linux/latest
-- Downloading binary...
bash: line 148: sudo: command not found
-- Setting permissions on binary...
bash: line 154: sudo: command not found
bash: line 163: firebase: command not found
Something went wrong, firebase has not been installed.
Please file a bug with your system information on Github.
https://github.com/firebase/firebase-tools/
-- All done!
The command '/bin/sh -c curl -sL https://firebase.tools | bash' returned a non-zero code: 1
Would appreciate any tips about how to do this. Using RUN npm install -g firebase-tools
is not an option since I'm building on a python image.
Ok, found a solution that works. Simply install node on a python image and then use npm to install the firebase-CLI.
Dockerfile:
FROM python:3.6.8
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
&& apt-get install -y nodejs
RUN npm install -g firebase-tools
And now I can run firebase commands from python!
import os
command = 'firebase projects:list --token CI_TOKEN'
os.system(command)
More info about using the firebase CLI with Continuous Integration can be found here.