Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

mark-norgate October 27, 2016

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

 

5 answers

3 votes
Philip Hodder
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 27, 2016

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

2 votes
Mina Luke April 9, 2018

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

Philip Hodder
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 10, 2018

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

0 votes
mark-norgate October 28, 2016

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

0 votes
Matt Shelton October 28, 2016

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

0 votes
mark-norgate October 27, 2016

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events