Redgate SQL Toolbelt components are not installing in Jenkins inbound-agent windows docker image - dockerfile

I am trying to create a custom Docker image using jenkins/inbound-agent:jdk17-windowsservercore-ltsc2019 image. In this custom image, I want to install Redgate SQL Change Automation Powershell tool.
I tried all different ways of installing it, however, this doesn't seems to install at all.
The different ways I tried are:
Using chocolatey RUN choco install sqltoolbelt -y --params "/products:'SQL Change Automation Powershell'") - This step just times out after running for a long time
Downloaded the SCAPowershell exe and tried to install it:
ENV SCA_URI=https://download.redgate.com/checkforupdates/SCAPowerShell/SCAPowerShell_4.5.22306.32404.exe
RUN Invoke-WebRequest -Uri $env:SCA_URI -OutFile C:\SCAPowerShell_4.5.22306.32404.exe; \
Start-Process -FilePath C:\SCAPowerShell_4.5.22306.32404.exe -ArgumentList "--quiet", "--wait", "/IAgreeToTheEula"
- This step doesn't throw any error, but the component is never installed inside C:\Program Files (x86)\Red Gate\ directory where it's supposed to install
Downloaded the SQL Toolbelt exe and tried to install it. This step also doesn't throw any error, but the component is never installed inside C:\Program Files (x86)\Red Gate\ directory where it's supposed to install
Installed powershell 7 and tried to install the SQL Change Automation module using:
RUN Install-Module SqlChangeAutomation -AcceptLicense -force
This also doesn't install the component inside C:\Program Files (x86)\Red Gate directory where it's supposed to install
Please could someone help me so that I can try to get this installed in my docker image.
I'm already installing some of the prerequisites before installing this Regdate SQL Change Automation tool, like VS Tools, SSMS, SQLLocalDB, VS Community, but it still doesn't install.
Thank you

I got it working after putting below in my Dockerfile. Here's my Dockerfile
FROM jenkins/inbound-agent:jdk17-windowsservercore-ltsc2019
SHELL ["powershell.exe", "-ExecutionPolicy", "Bypass", "-Command"]
RUN ["powershell","Set-ExecutionPolicy Bypass -Scope Process -Force;","iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"]
# Install VS Tools
RUN Invoke-WebRequest -Uri https://aka.ms/vs/17/release/vs_buildtools.exe -OutFile C:\vs_buildtools.exe; \
Start-Process -FilePath C:\vs_buildtools.exe -ArgumentList "install", "--installPath", "C:/BuildTools", "--quiet", "--wait", "--add", "Microsoft.VisualStudio.Workload.VCTools", "--add", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64" -Wait -PassThru
# Install 7Zip
RUN choco install 7zip.install -y
# Install SQL Server 2019
ADD https://download.microsoft.com/download/7/c/1/7c14e92e-bdcb-4f89-b7cf-93543e7112d1/SQLServer2019-x64-ENU-Dev.iso C:\\Users\\jenkins\\SQLServer2019-x64-ENU-Dev.iso
RUN 7z.exe x -y -oC:\\Users\\jenkins\\sqlserversetup C:\\Users\\jenkins\\SQLServer2019-x64-ENU-Dev.iso; \
powershell -Command Remove-Item C:\\Users\\jenkins\\SQLServer2019-x64-ENU-Dev.iso; \
C:\\Users\\jenkins\\sqlserversetup\\setup.exe /q /ACTION=Install /INSTANCENAME=MSSQLSERVER /FEATURES=SQLEngine /UPDATEENABLED=0 /SQLSVCACCOUNT='NT AUTHORITY\System' /SQLSYSADMINACCOUNTS='BUILTIN\ADMINISTRATORS' /TCPENABLED=1 /NPENABLED=0 /IACCEPTSQLSERVERLICENSETERMS
# Install Net Framerwork 4.7
RUN choco install -y netfx-4.7-devpack
# Install VS Community
RUN Invoke-WebRequest -Uri https://aka.ms/vs/17/release/vs_Community.exe -OutFile C:\vs_Community.exe; \
Start-Process -FilePath C:\vs_Community.exe -ArgumentList "install", "--installPath", "C:/VS", "--quiet", "--wait", "--norestart", "--add", "Microsoft.VisualStudio.Workload.CoreEditor", "--add", "Microsoft.VisualStudio.Workload.Data" -Wait -PassThru
# Check installation done or not
RUN dir C:/VS
RUN dir C:/BuildTools
# Install MS ODBC Driver for SQL Server
RUN Invoke-WebRequest -Uri https://download.microsoft.com/download/D/5/E/D5EEF288-A277-45C8-855B-8E2CB7E25B96/x64/msodbcsql.msi -OutFile C:\msodbcsql.msi; \
Start-Process msiexec.exe -Wait -ArgumentList '/I C:\msodbcsql.msi /quiet'
# Install MS Command Line Utilities
RUN Invoke-WebRequest -Uri https://download.microsoft.com/download/C/8/8/C88C2E51-8D23-4301-9F4B-64C8E2F163C5/x64/MsSqlCmdLnUtils.msi -OutFile C:\MsSqlCmdLnUtils.msi; \
Start-Process msiexec.exe -Wait -ArgumentList '/I C:\MsSqlCmdLnUtils.msi /quiet'
#Install SSMS
RUN choco install sql-server-management-studio -y
# Install SQL Change Automation
#RUN choco install sqltoolbelt -y --params "/products:'SQL Change Automation, SQL Change Automation Powershell'"
#RUN Install-PackageProvider NuGet -Force; Install-Module PowerShellGet -MinimumVersion 1.6 -Force -AllowClobber
#RUN Install-Module SqlChangeAutomation -Scope CurrentUser -AcceptLicense
RUN Get-PackageProvider NuGet -ForceBootstrap | Out-Null; Import-PackageProvider PowerShellGet; \
Install-Module -Name PowerShellGet -RequiredVersion 2.2.5 -Force; \
Invoke-Command { & "powershell.exe" } -NoNewScope
RUN Install-Module -Name SqlChangeAutomation -Force -AcceptLicense -ErrorAction Stop
RUN Invoke-Command { & "powershell.exe" } -NoNewScope
#RUN Invoke-DatabaseBuild
# Install pwsh
RUN choco install pwsh -y
SHELL ["pwsh", "-Command"]
# Set environment variable for MSBuild
RUN setx /M PATH $($Env:PATH+';C:/BuildTools/MSBuild/Current/bin/;')
# Install aws cli
RUN choco install awscli -y
#Install SQLLocalDB
RUN choco install sqllocaldb -y

Related

"Sagemaker Notebook with Interactive Session -- Install packages

We have followed this doc to spin up notebook running with interactive sessions. We want to add a few python packages to the environment to assist with development (i.e. pyright). I have added the pip install at the bottom, stopped the instance, restart instance, run "import pyright", but I get "ModuleNotFoundError: No module named 'pyright'"
#!/bin/bash
set -ex
sudo -u ec2-user -i <<'EOF'
ANACONDA_DIR=/home/ec2-user/anaconda3
# Create and Activate Conda Env
echo "Creating glue_pyspark conda enviornment"
conda create --name glue_pyspark python=3.7 ipykernel jupyter nb_conda -y
echo "Activating glue_pyspark"
source activate glue_pyspark
# Install Glue Sessions to Env
echo "Installing AWS Glue Sessions with pip"
pip install aws-glue-sessions
# Clone glue_pyspark to glue_scala. This is required because I had to match kernel naming conventions to their environments and couldn't have two kernels in one conda env.
echo "Cloning glue_pyspark to glue_scala"
conda create --name glue_scala --clone glue_pyspark
# Remove python3 kernel from glue_pyspark
rm -r ${ANACONDA_DIR}/envs/glue_pyspark/share/jupyter/kernels/python3
rm -r ${ANACONDA_DIR}/envs/glue_scala/share/jupyter/kernels/python3
# Copy kernels to Jupyter kernel env (Discoverable by conda_nb_kernel)
echo "Copying Glue PySpark Kernel"
cp -r ${ANACONDA_DIR}/envs/glue_pyspark/lib/python3.7/site-packages/aws_glue_interactive_sessions_kernel/glue_pyspark/ ${ANACONDA_DIR}/envs/glue_pyspark/share/jupyter/kernels/glue_pyspark/
echo "Copying Glue Spark Kernel"
mkdir ${ANACONDA_DIR}/envs/glue_scala/share/jupyter/kernels
cp -r ${ANACONDA_DIR}/envs/glue_scala/lib/python3.7/site-packages/aws_glue_interactive_sessions_kernel/glue_spark/ ${ANACONDA_DIR}/envs/glue_scala/share/jupyter/kernels/glue_spark/
echo "Changing Jupyter kernel manager from EnvironmentKernelSpecManager to CondaKernelSpecManager"
JUPYTER_CONFIG=/home/ec2-user/.jupyter/jupyter_notebook_config.py
sed -i '/EnvironmentKernelSpecManager/ s/^/#/' ${JUPYTER_CONFIG}
echo "c.CondaKernelSpecManager.name_format='conda_{environment}'" >> ${JUPYTER_CONFIG}
echo "c.CondaKernelSpecManager.env_filter='anaconda3$|JupyterSystemEnv$|/R$'" >> ${JUPYTER_CONFIG}
# Install python modules to env
pip install "pyright"
EOF
systemctl restart jupyter-server
Am I missing something in the script? I assumed just "pip install "pyright"" would've worked.
Update:
I have included the following under the pip install aws-glue-sessions:
pip install "pyright"
and
pip install pyright
When I check the CloudWatch logs, I see that the package is being downloaded... I would assume it means it's installed.
[1]: https://i.stack.imgur.com/JeKce.png

Composer within Dockerfile on Google Cloud Run

My application is successfully deployed to Google Cloud Run and is a PHP-based website. The site makes use of Google's sign-in API which requires composer google/apiclient.
I can't figure out how to build the required /vendor folder structure (i.e. installing composer) within the Dockerfile. My workaround currently is to include the /vendor folder structure in my code and build that as part of the cloud run deploy ....
My Dockerfile (which contains no reference to the requirement for composer and the google/apiclient) looks like this:
# Use the official PHP image.
# https://hub.docker.com/_/php
FROM php:8.0-apache
# Configure PHP for Cloud Run.
# Precompile PHP code with opcache.
RUN docker-php-ext-install -j "$(nproc)" opcache
RUN docker-php-ext-install -j "$(nproc)" mysqli
RUN set -ex; \
{ \
echo "; Cloud Run enforces memory & timeouts"; \
echo "memory_limit = -1"; \
echo "max_execution_time = 0"; \
echo "; File upload at Cloud Run network limit"; \
echo "upload_max_filesize = 32M"; \
echo "post_max_size = 32M"; \
echo "; Configure Opcache for Containers"; \
echo "opcache.enable = On"; \
echo "opcache.validate_timestamps = Off"; \
echo "; Configure Opcache Memory (Application-specific)"; \
echo "opcache.memory_consumption = 32"; \
} > "$PHP_INI_DIR/conf.d/cloud-run.ini"
# Copy in custom code from the host machine.
WORKDIR /var/www/html
COPY . ./
# Use the PORT environment variable in Apache configuration files.
# https://cloud.google.com/run/docs/reference/container-contract#port
RUN sed -i 's/80/${PORT}/g' /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf
# Configure PHP for development.
# Switch to the production php.ini for production operations.
# RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
# https://github.com/docker-library/docs/blob/master/php/README.md#configuration
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
My composer.json file:
{
"require": {
"google/apiclient": "^2.11"
}
}
I found this post, and attempted the multi-stage build approach as mentioned here by including the following at the end of my Dockerfile, but this throws an error on build:
FROM composer as builder
WORKDIR /app/
COPY composer.* ./
RUN composer install
COPY --from=builder /app/vendor /var/www/html/vendor
When I attempted to view the logs, the console informed me that I didn't have the required permissions. I added Cloud Build Viewer and Cloud Build Editor as per this post in order to view the error.
All preceding steps complete and I can see the The error states:
Step 13/13 : COPY --from=builder /app/vendor /var/www/html/vendor
invalid from flag value builder: pull access denied for builder, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1
How do I reference the container with the successful composer build? Do I need another step, or is the COPY statement in the wrong place?
You don't need to set up a multi-stage build to run composer, you can simply install and run composer at the php:8.0-apache Dockerfile.
There are some options.
Installing composer with no composer.json file:
RUN apt update && apt install -y zip
RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/composer \
&& chmod +x /usr/local/bin/composer
RUN composer require google/apiclient:^2.11 \
&& composer clear-cache
Installing composer with composer.json file:
RUN apt update && apt install -y zip
RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/local/bin/composer \
&& chmod +x /usr/local/bin/composer
RUN composer install \
&& composer clear-cache
composer.json:
{
"require": {
"google/apiclient": "^2.11"
}
}
With that, composer will be installed along with the deps in /var/www/html since it is the WORKDIR.
I think the problem was that I was attempting to copy the composer install (builder) from itself. I found this link which suggested that the composer install could be done first and then referenced within the php build (which also copies my source files).
My updated Dockerfile now reads as follows, and it successfully builds!
#Install composer
FROM composer:latest as composer
WORKDIR /var/www/html
#COPY the composer.json and composer.lock files to the working directory
COPY composer.* ./
RUN composer install
# Use the official PHP image.
# https://hub.docker.com/_/php
FROM php:8.0-apache
#Copy the composer install (/vendor folders) into the working directory
COPY --from=composer /var/www/html .
# Use the official PHP image.
# https://hub.docker.com/_/php
FROM php:8.0-apache
# Configure PHP for Cloud Run.
# Precompile PHP code with opcache.
RUN docker-php-ext-install -j "$(nproc)" opcache
RUN docker-php-ext-install -j "$(nproc)" mysqli
RUN set -ex; \
{ \
echo "; Cloud Run enforces memory & timeouts"; \
echo "memory_limit = -1"; \
echo "max_execution_time = 0"; \
echo "; File upload at Cloud Run network limit"; \
echo "upload_max_filesize = 32M"; \
echo "post_max_size = 32M"; \
echo "; Configure Opcache for Containers"; \
echo "opcache.enable = On"; \
echo "opcache.validate_timestamps = Off"; \
echo "; Configure Opcache Memory (Application-specific)"; \
echo "opcache.memory_consumption = 32"; \
} > "$PHP_INI_DIR/conf.d/cloud-run.ini"
# Copy in custom code from the host machine.
WORKDIR /var/www/html
COPY . ./
# Use the PORT environment variable in Apache configuration files.
# https://cloud.google.com/run/docs/reference/container-contract#port
RUN sed -i 's/80/${PORT}/g' /etc/apache2/sites-available/000-default.conf /etc/apache2/ports.conf
# Configure PHP for development.
# Switch to the production php.ini for production operations.
# RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
# https://github.com/docker-library/docs/blob/master/php/README.md#configuration
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
Presumably I could equally have called the referenced the PHP build step as FROM php:8.0-apache as PHPBuild and then copied the result into the composer build step with COPY --FROM PHPBuild /var/www/html .?

sdkman does not install java in a dockerfile

I have this docker file:
# We are going to star from the jhipster image
FROM jhipster/jhipster
# install as root
USER root
### Setup docker cli (don't need docker daemon) ###
# Install some packages
RUN apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y
# Add Dockers official GPG key:
RUN ["/bin/bash", "-c", "set -o pipefail && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -"]
# Add a stable repository
RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# Setup aws credentials as environment variables
ENV AWS_ACCESS_KEY_ID "change it!"
ENV AWS_SECRET_ACCESS_KEY "change it!"
# noninteractive install for tzdata
ARG DEBIAN_FRONTEND=noninteractive
# set timezone for tzdata
ENV TZ=America/Sao_Paulo
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Install the latest version of Docker Engine - Community and also aws cli
RUN apt-get update && apt-get install docker-ce docker-ce-cli containerd.io awscli -y
# change back to default user
USER jhipster
# install skd and java version 1.8
RUN curl -s "https://get.sdkman.io" | bash
RUN bash $HOME/.sdkman/bin/sdkman-init.sh
RUN bash -c "sdk install java 8.0.222.j9-adpt"
When I run a command to build an image from this dockerfile it fails on the last step with a message:
/bin/sh: 1: sdk: not found
When I install it on my local machine it runs sdkman (sdk) on bash. But on this script it calls it from sh not bash. How can I make it calls skdman (sdk) from sh? What I actually want to do is install a specific java version through sdkman (sdk). Is there another way to do it?
For sdk command to be available you need to run source sdkman-init.sh.
Here is a working sample with java 11 on centos.
FROM centos:latest
ARG CANDIDATE=java
ARG CANDIDATE_VERSION=11.0.6-open
ENV SDKMAN_DIR=/root/.sdkman
# update the image
RUN yum -y upgrade
# install requirements, install and configure sdkman
# see https://sdkman.io/usage for configuration options
RUN yum -y install curl ca-certificates zip unzip openssl which findutils && \
update-ca-trust && \
curl -s "https://get.sdkman.io" | bash && \
echo "sdkman_auto_answer=true" > $SDKMAN_DIR/etc/config && \
echo "sdkman_auto_selfupdate=false" >> $SDKMAN_DIR/etc/config
# Source sdkman to make the sdk command available and install candidate
RUN bash -c "source $SDKMAN_DIR/bin/sdkman-init.sh && sdk install $CANDIDATE $CANDIDATE_VERSION"
# Add candidate path to $PATH environment variable
ENV JAVA_HOME="$SDKMAN_DIR/candidates/java/current"
ENV PATH="$JAVA_HOME/bin:$PATH"
ENTRYPOINT ["/bin/bash", "-c", "source $SDKMAN_DIR/bin/sdkman-init.sh && \"$#\"", "-s"]
CMD ["sdk", "help"]
The problem is every RUN command in Dockerfile is executed within a new bash environment, so you need to put both of your last two commands under the same line to look like this:
RUN bash $HOME/.sdkman/bin/sdkman-init.sh && bash -c "sdk install java 8.0.222.j9-adpt"

Compiling Qt5 project in windows docker container

I'm setting up a Docker container with Qt5 5.12.2 and I'm using a microsoft visual studio 15 compiler msvc2015_64 to build my project. However, I get a LNK1112: module machine type 'x64' conflicts with target machine type 'X86' error when building.
My first step is to build the Qt5 project with the same commands that are generated by Qt Creator:
C:\Qt\5.12.2\msvc2015_64\bin\qmake.exe C:\Users\userA\Desktop\Projects\myproj\app.pro -spec win32-msvc "CONFIG+=debug" "CONFIG+=qtquickcompiler" && C:\Qt\Tools\QtCreator\bin\jom.exe qmake_all
C:\Qt\Tools\QtCreator\bin\jom.exe
This produces the machine type conflict error.
I have tried to add the following paths to my %path% env variable:
C:\Windows\System32
C:\Qt\5.12.2\msvc2015_64\bin
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
Already in my path env variable:
C:\Program Files (x86)\Windows Kits\8.1\bin\x86
C:\Program Files (x86)\Windows Kits\8.1\Windows Perormance Toolkit\
I have also tried to run the .bat files inside Microsoft Visual Studio 14.0:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\vcvarsx86_amd64.bat
Output of running the .bat file:
ERROR: Cannot determine the location of the VS Common Tools folder
I've looked this error up and I think the suggestion was to add the C:\Windows\System32 to the env variable %path%. I tried that but same error.
My Dockerfile:
FROM microsoft/windowsservercore:10.0.14393.1884
LABEL Description="Windows Server Core development environment for Qbs with Qt 5.12.2, Chocolatey and various dependencies for testing Qbs modules and functionality"
# Disable crash dialog for release-mode runtimes
RUN reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting" /v Disabled /t REG_DWORD /d 1 /f
RUN reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting" /v DontShowUI /t REG_DWORD /d 1 /f
# Install Qt5 5.12.2
COPY qtifwsilent.qs C:\\qtifwsilent.qs
RUN powershell -NoProfile -ExecutionPolicy Bypass -Command \
$ErrorActionPreference = 'Stop'; \
$Wc = New-Object System.Net.WebClient ; \
$Wc.DownloadFile('http://download.qt.io/archive/qt/5.12/5.12.2/qt-opensource-windows-x86-5.12.2.exe', 'C:\qt.exe') ; \
Echo 'Downloaded qt-opensource-windows-x86-5.12.2.exe' ; \
$Env:QT_INSTALL_DIR = 'C:\\Qt' ; \
Start-Process C:\qt.exe -ArgumentList '--verbose --script C:/qtifwsilent.qs' -NoNewWindow -Wait ; \
Remove-Item C:\qt.exe -Force ; \
Remove-Item C:\qtifwsilent.qs -Force
ENV QTDIR C:\\Qt\\5.12.2\\msvc2015
ENV QTDIR64 C:\\Qt\\5.12.2\\msvc2015_64
RUN dir "%QTDIR64%" && dir "%QTDIR64%\bin"
# Install choco for psuedo package manager
RUN #powershell -NoProfile -ExecutionPolicy Bypass -Command \
$Env:chocolateyVersion = '0.10.8' ; \
$Env:chocolateyUseWindowsCompression = 'false' ; \
"iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
RUN choco install -y python2 --version 2.7.14 && refreshenv && python --version && pip --version
RUN choco install -y qbs --version 1.9.1 && qbs --version
RUN choco install -y unzip --version 6.0 && unzip -v
RUN choco install -y visualcpp-build-tools --version 14.0.25420.1 && dir "%PROGRAMFILES(X86)%\Microsoft Visual C++ Build Tools"
# RUN choco install -y windows-sdk-10.1
# RUN choco install -y vcredist2008 --version 9.0.30729.6161
# RUN choco install -y vcredist2010
RUN choco install -y zip --version 3.0 && zip -v
# for building the documentation
RUN pip install beautifulsoup4 lxml
My qtifwsilent.qs to setup Qt5 has these components:
widget.deselectAll();
widget.selectComponent("qt.qt5.5122.win32_msvc2015");
widget.selectComponent("qt.qt5.5122.win64_msvc2015_64");
widget.selectComponent("qt.qt5.5122.qtcharts");
widget.selectComponent("qt.qt5.5122.qtdatavis3d");
widget.selectComponent("qt.qt5.5122.qtpurchasing");
widget.selectComponent("qt.qt5.5122.qtvirtualkeyboard");
widget.selectComponent("qt.qt5.5122.qtwebengine");
widget.selectComponent("qt.qt5.5122.qtnetworkauth");
widget.selectComponent("qt.qt5.5122.qtwebglplugin");
widget.selectComponent("qt.qt5.5122.qtscript");
widget.selectComponent("qt.tools.vcredist_msvc2015_x86");
widget.selectComponent("qt.tools.vcredist_msvc2015_x64");
I expect the project to build and generate an exe file.
I solved the problem so I'm just posting this here for future reference.
I had to update the Dockerfile to use a newer version of servercore as well as included required Windows kits. I also had to add several paths to my %path% environment variable as shown below.
FROM mcr.microsoft.com/windows/servercore:ltsc2019
LABEL Description="Windows Server Core development environment for Qbs with Qt 5.12.2, Chocolatey and various dependencies for testing Qbs modules and functionality"
# Disable crash dialog for release-mode runtimes
RUN reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting" /v Disabled /t REG_DWORD /d 1 /f
RUN reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting" /v DontShowUI /t REG_DWORD /d 1 /f
# Install Qt5 5.12.2
COPY qtifwsilent.qs C:\\qtifwsilent.qs
RUN powershell -NoProfile -ExecutionPolicy Bypass -Command \
$ErrorActionPreference = 'Stop'; \
$Wc = New-Object System.Net.WebClient ; \
$Wc.DownloadFile('http://download.qt.io/archive/qt/5.12/5.12.2/qt-opensource-windows-x86-5.12.2.exe', 'C:\qt.exe') ; \
Echo 'Downloaded qt-opensource-windows-x86-5.12.2.exe' ; \
$Env:QT_INSTALL_DIR = 'C:\\Qt' ; \
Start-Process C:\qt.exe -ArgumentList '--verbose --script C:/qtifwsilent.qs' -NoNewWindow -Wait ; \
Remove-Item C:\qt.exe -Force ; \
Remove-Item C:\qtifwsilent.qs -Force
ENV QTDIR C:\\Qt\\5.12.2\\msvc2015
ENV QTDIR64 C:\\Qt\\5.12.2\\msvc2015_64
RUN dir "%QTDIR64%" && dir "%QTDIR64%\bin"
# Install choco for psuedo package manager
RUN #powershell -NoProfile -ExecutionPolicy Bypass -Command \
$Env:chocolateyVersion = '0.10.14' ; \
$Env:chocolateyUseWindowsCompression = 'false' ; \
"iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
RUN choco install -y python2 --version 2.7.14 && refreshenv && python --version && pip --version
RUN choco install -y qbs && qbs --version
RUN choco install -y unzip --version 6.0 && unzip -v
RUN choco install -y vcbuildtools -ia "/Full"
RUN choco install -y zip --version 3.0 && zip -v
RUN choco install -y cmake
RUN choco install -y windows-sdk-10.1
RUN choco install -y vcredist2008 --version 9.0.30729.6161
RUN choco install -y vcredist2010
# for building the documentation
RUN pip install beautifulsoup4 lxml
WORKDIR C:\\Users\\ContainerUser
For the environment path I used:
set path=%path%;"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC";C:\Qt\5.12.2\msvc2015_64\bin;"C:\Program Files (x86)\Windows Kits\10\bin\x64";"C:\Program Files (x86)\Windows Kits\8.1\bin\x64";C:\Qt\Tools\QtCreator\bin;
# Run this command to setup cl.exe
vcvarsall.bat x86_amd64

Passing this visual c++ redistributable 2017 x86 as prereq in my docker file is not installing

I have a docker image with prerequisite visual c++ redistributable 2017 x86(exe) but after instantiating the container i see that this redistributable not installed.|
i went inside the container and try to install exe here manually then also no luck
inside my docker file i used this run cmd
RUN Start-Process -FilePath 'c:\tmp\prereq\vc_redist.x86.exe' -ArgumentList '/quiet /install /norestart' -Wait; \
Remove-Item 'c:\tmp\prereq\vc_redist.x86.exe'
My docker file below
FROM microsoft/aspnet:4.7.1
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
MAINTAINER
Install Windows features for IIS
RUN Add-WindowsFeature Web-server, NET-Framework-45-ASPNET, Web-Asp-Net45
RUN Enable-WindowsOptionalFeature -Online -FeatureName IIS-ApplicationDevelopment,IIS-ASPNET45,IIS-WindowsAuthentication
RUN New-Item -Path 'c:/tmp/prereq' -ItemType Directory
COPY ./prereq "c:\tmp\prereq"
RUN Start-Process -FilePath 'c:\tmp\prereq\vc_redist.x64.exe' -ArgumentList '/q' -Wait; \
Remove-Item 'c:\tmp\prereq\vc_redist.x64.exe'
COPY ./website "c:\iis\website"
RUN Remove-WebSite -Name 'Default Web Site'; \
New-Website -Name 'Default Web Site' -PhysicalPath 'C:\inetpub' -Port 80; \
New-WebApplication -Name "QualityWebService" -Site 'Default Web Site' -PhysicalPath 'c:\iis\website' -ApplicationPool "DefaultAppPool"; \
Invoke-Command -scriptblock {iisreset}
EXPOSE 80