0

I have two Dockerfiles. In Cloudformation I want CodeBuild to build two images from the two Dockerfiles. I might need two different buildspec files for that, and one CodeBuild. Is this possible?

vasil001
  • 2,501
  • 4
  • 8
  • 22

1 Answers1

2

Yes you can do it. You can override default buildspec.yml when you run your build. Thus you can have a single build project which will take different buildspec.yml files.

To do this, in AWS CLI, you can use --buildspec-override option:

A buildspec file declaration that overrides, for this build only, the latest one already defined in the build project.

Marcin
  • 215,873
  • 14
  • 235
  • 294
  • How can I then tell the other buildspec.yaml, to build an image from another Dockerfile? – vasil001 Jan 18 '21 at 09:39
  • @vasil001 You can't just execute other build from first build. You have to start new build and new container. But you can use the same project, just overwrite its buildpsec.yml path. – Marcin Jan 18 '21 at 10:08