How to use Bamboo variables when using an existing Dockerfile in a Docker build task
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Fisheye および Crucible は除く
目的
When using a Docker task in Bamboo to build a docker image, it may be desirable to pass and dereference Bamboo variables even when using an existing Dockerfile.
ソリューション
Use Docker build arguments:
It can be configured in Bamboo inside your Docker task configuration using the Additional Arguments field. Example below:
--build-arg VERSION=${bamboo.versionVariable}
ARG VERSION
RUN curl -L --silent https://packages.atlassian.com/maven-external/com/atlassian/bamboo/atlassian-bamboo/${VERSION}/atlassian-bamboo-${VERSION}.pom > /tmp/pom.xml