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
            - step:
                    - 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!



5 answers

1 vote

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

I know this is so late reply. However, I had the same issue and end up with 2 steps pipeline. Perhaps in 2016 at the time of this thread the multiple steps as a feature was not there. but it is an interesting feature that separate the pipelines into multiple steps . For this scenario one step for installing and run testing (node image) and the other step is for deployment (python image).

We shipped multiple steps in 2017, so your approach is correct. And in my opinion, cleaner.

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.


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 Sign up to answer
Community showcase
Published Mar 14, 2019 in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder

...ipe.sh :  #!/bin/bash source "$(dirname "$0")/common.sh" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

279 views 0 12
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