0

First of all, I'm brand new to Docker! I am currently trying to create my own docker image which I can use in my bitbucket pipelines. What I am trying to do is install node and ruby on the same container. Here is what my current Dockerfile looks like:

FROM node:12.22.10

FROM ruby:2.7.5

I've built, tagged and pushed this image and use it in my bitbucket-pipelines.yml and I'm trying to run this step script:

script:
    - yarn install
    - gem install bundler -v 2.2.29

When this is run in the pipeline I get this error:

bash: yarn: command not found

I've tried a couple of things, I removed the FROM ruby:2.7.5 and the yarn command worked but obviously the gem install bundler... did not. So, I know that the Dockerfile and image are working but I don't know how to use both images in my own Dockerfile. Does anyone know what I'm doing wrong?

  • There's no way to combine multiple images together. Each `FROM` line starts over from scratch. You can use this feature to copy built artifacts from one image to another, but not the language runtime. Instead, you need to pick one of the base images and install the other language runtime into it; the "run yarn install" command I linked to has a Ruby+Node example (see the long `RUN` line in the Dockerfiles; ignore the answer's advice to do all of the build work outside Docker). – David Maze Mar 02 '22 at 11:28
  • @DavidMaze Thank you for this. Got it working as expected! – Rick Henry Mar 02 '22 at 13:06

0 Answers0