I am trying to build a docker container with the atlassian-build-runner but make it configurable to specify either latest version (w/o suffix) or latest version using a suffix using the following snippet:
ARG BASE_IMAGE=mcr.microsoft.com/dotnet/framework/sdk:4.8
FROM $BASE_IMAGE
...
# Install Atlassian build, specify --build-arg=-x.y to use different version than latest release
ARG BUILDER_VERSION=""
ADD https://product-downloads.atlassian.com/software/bitbucket/pipelines/atlassian-bitbucket-pipelines-runner$BUILDER_VERSION.zip bitbucket-pipelines-runner.zip
RUN powershell -Command Expand-Archive bitbucket-pipelines-runner.zip C:\bitbucket-pipelines-runner
I would like the user to not have to specify a leading dash (-) in the build argument. Any pointers on how to do this on a Windows container?
I already tried modifying the environment variable in PowerShell (default shell for the Windows base image) to no avail:
ARG BUILDER_VERSION=""
ENV BUILDER_VERSION=$BUILDER_VERSION
ENV if ([string]::IsNullOrEmpty($Env:BUILDER_VERSION)) { return "-" + $Env:BUILDER_VERSION}
But it keeps failing the download since the dash is missing when a version build argument is supplied. Any pointers?