Is it possible to use multiple docker images in bitbucket pipeline?

James Lin picture James Lin · Oct 21, 2016 · Viewed 16k times · Source

I have this pipeline file to unittest my project:

image: jameslin/python-test

    pipelines:
      default:
        - step:
            script:
              - service mysql start
              - pip install -r requirements/test.txt
              - export DJANGO_CONFIGURATION=Test
              - python manage.py test

but is it possible to switch to another docker image to deploy?

image: jameslin/python-deploy

    pipelines:
      default:
        - step:
            script: 
              - ansible-playbook deploy

I cannot seem to find any documentation saying either Yes or No.

Answer

Dmitry Zaytsev picture Dmitry Zaytsev · Jan 7, 2018

You can specify an image for each step. Like that:

pipelines:
  default:
    - step:
        name: Build and test
        image: node:8.6
        script:
          - npm install
          - npm test
          - npm run build
        artifacts:
          - dist/**
    - step:
        name: Deploy
        image: python:3.5.1
        trigger: manual
        script:
          - python deploy.py