Pipelines: How do I get both the latest node and Python running in my docker image?

Hi there

I need a docker image with the latest Python (3.5.x) because I am using some of the more recent Python methods, and nodejs/npm because I am building my app using Webpack 2.

I have the choice, it seems, of using the Python docker and install npm; or the node Docker and install Python. Both of these have turned out to be a little difficult — at the moment I am running a Python image and am trying to install nodejs/npm.

I am having real problems installing nodejs/npm. My bitbucket-pipelines.yml looks like this:

image: python:3.5.1
pipelines:
    branches:
        master:
            - step:
                script:
                    - apt-get update
                    - apt-get install lsb-release -y
                    # need to install lsb-release here
                    - curl --silent https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
                    - VERSION=node_5.x
                    - DISTRO="$(lsb_release -s -c)"
                    - echo "deb https://deb.nodesource.com/$VERSION $DISTRO main" | tee /etc/apt/sources.list.d/nodesource.list
                    - echo "deb-src https://deb.nodesource.com/$VERSION $DISTRO main" | tee -a /etc/apt/sources.list.d/nodesource.list
                    - apt-get update
                    - apt-get install nodejs -y
                    - npm install
                    - npm run build
                    - python get-pip.py
                    - pip install boto3==1.3.0
                    - python s3_upload.py io-master.fromthiscomesthat.co.uk dist io-master

The problem is, I don't really know enough about the environment to download and install the lsb_release executable/binary that is needed to set the DISTRO variable.

Am I approaching this in the wrong way? What can I do to get the release into the DISTO variable?

Please help!

Mark

 

4 answers

0 votes

You can try to debug this locally by following this guide: https://confluence.atlassian.com/display/BITBUCKET/Debug+your+pipelines+locally+with+Docker

To address your nodejs vs python question. You can create a Docker image that has both: https://confluence.atlassian.com/display/BITBUCKET/Use+Docker+images+as+build+environments+in+Bitbucket+Pipelines#UseDockerimagesasbuildenvironmentsinBitbucketPipelines-Createnewenvironments Or you can find an existing on to use on Dockerhub.

Gotta dash off now, so I can't give this a proper look. Hopefully, this will help you make some progress. smile

Thank you for your response @Philip Hodder. I have decided to go down the route of creating my own image. Perhaps I should create it in my own image and see how it feels to be a God.

Ahem.

As it goes, I have already run into an obstacle. Does this make any sense?

It seems someone has already marked my question down. Grr.

You might try using an existing image on Docker Hub that already has both. Maybe https://hub.docker.com/r/nsdont/python-node/ or https://hub.docker.com/r/zbyte64/docker-python-node/~/dockerfile/ ?

I've sorted it now, thanks. Using a virtual machine inside Docker to run Python in an isolated environment.

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

638 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot