|
| 1 | +ARG OS_RELEASE |
| 2 | + |
| 3 | +FROM mcr.microsoft.com/windows/servercore:${OS_RELEASE} as download |
| 4 | + |
| 5 | +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] |
| 6 | + |
| 7 | +ENV GIT_VERSION 2.39.0 |
| 8 | +ENV NODE_VERSION 16.20.0 |
| 9 | +ENV YARN_VERSION 1.22.19 |
| 10 | + |
| 11 | +# Download and install git |
| 12 | +RUN Invoke-WebRequest $('https://github.com/git-for-windows/git/releases/download/v{0}.windows.1/MinGit-{0}-64-bit.zip' -f $env:GIT_VERSION) -OutFile 'MinGit.zip' -UseBasicParsing ; \ |
| 13 | + Expand-Archive c:\MinGit.zip -DestinationPath c:\MinGit; \ |
| 14 | + $env:PATH = $env:PATH + ';C:\MinGit\cmd\;C:\MinGit\cmd'; \ |
| 15 | + Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $env:PATH |
| 16 | + |
| 17 | +# Download and install node.js |
| 18 | +RUN Invoke-WebRequest $('https://nodejs.org/dist/v{0}/node-v{0}-win-x64.zip' -f $env:NODE_VERSION) -OutFile 'node.zip' -UseBasicParsing ; \ |
| 19 | + # $sum = $(cat SHASUMS256.txt.asc | sls $(' node-v{0}-win-x64.zip' -f $env:NODE_VERSION)) -Split ' ' ; \ |
| 20 | + # if ((Get-FileHash node.zip -Algorithm sha256).Hash -ne $sum[0]) { Write-Error 'SHA256 mismatch' } ; \ |
| 21 | + Expand-Archive node.zip -DestinationPath C:\ ; \ |
| 22 | + Rename-Item -Path $('C:\node-v{0}-win-x64' -f $env:NODE_VERSION) -NewName 'C:\nodejs' |
| 23 | + |
| 24 | +# Download and install yarn |
| 25 | +RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \ |
| 26 | + Invoke-WebRequest $('https://github.com/yarnpkg/yarn/releases/download/v{0}/yarn-{0}.msi' -f $env:YARN_VERSION) -OutFile yarn.msi -UseBasicParsing ; \ |
| 27 | + Start-Process msiexec.exe -ArgumentList '/i', 'yarn.msi', '/quiet', '/norestart' -NoNewWindow -Wait |
| 28 | + |
| 29 | +FROM download as install |
| 30 | + |
| 31 | +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] |
| 32 | + |
| 33 | +ENV NPM_CONFIG_LOGLEVEL info |
| 34 | + |
| 35 | +COPY --from=download /nodejs /nodejs |
| 36 | +COPY --from=download [ "/Program Files (x86)/yarn", "/yarn" ] |
| 37 | + |
| 38 | +RUN $env:PATH = 'C:\nodejs;C:\yarn\bin;{0}' -f $env:PATH ; \ |
| 39 | + [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine) |
| 40 | + |
| 41 | +FROM install |
| 42 | + |
| 43 | +WORKDIR C:/cf-container-logger |
| 44 | + |
| 45 | +COPY package.json ./ |
| 46 | + |
| 47 | +COPY yarn.lock ./ |
| 48 | + |
| 49 | +RUN yarn install --frozen-lockfile --production |
| 50 | + |
| 51 | +COPY . ./ |
| 52 | + |
| 53 | +LABEL owner="codefresh.io" |
| 54 | + |
| 55 | +CMD ["powershell", "./lib/forever.ps1"] |
0 commit comments