I have the following docker file which downloads different things base on an argument passed in from docker-compose (either 2019 or 2022)
FROM mcr.microsoft.com/windows/servercore:ltsc2022
ARG VSVersion
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
WORKDIR /Temp
SHELL ["cmd", "/S", "/C"]
RUN if [ "$VSVersion" == "2019" ]; then `
curl -SL --output vs_buildtools.exe https://aka.ms/vs/16/release/vs_buildtools.exe...
My issue is, the conditional run command is not working - it doesn't install in the above syntax.
I also tried using "%VSVersion%"=="2019" because it's default windows shell, but I get error: "2019"=="2019" was unexpected at this time .
Could someone please point me towards the right syntax because I've tried various combinations, with and without quotations, to no avail...
thanks
Dockerfile is in windows shell not bash, so change the if statement syntax to batch instead of bash:
RUN if "%VSVersion%"=="2019"( `
# Download the Build Tools bootstrapper.
curl -SL --output vs_buildtools.exe.. )
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.