<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Shalini  on Medium]]></title>
        <description><![CDATA[Stories by Shalini  on Medium]]></description>
        <link>https://medium.com/@shalini07.23?source=rss-32507937fcd9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*SW80aab5uex4ru0a</url>
            <title>Stories by Shalini  on Medium</title>
            <link>https://medium.com/@shalini07.23?source=rss-32507937fcd9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 19:14:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shalini07.23/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Swift on Windows — Part2(Docker Container)]]></title>
            <link>https://medium.com/vmware-end-user-computing/swift-on-windows-part2-docker-container-4c3e1b197f17?source=rss-32507937fcd9------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c3e1b197f17</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[windows-11]]></category>
            <category><![CDATA[dockerfiles]]></category>
            <dc:creator><![CDATA[Shalini ]]></dc:creator>
            <pubDate>Fri, 20 Jan 2023 19:11:55 GMT</pubDate>
            <atom:updated>2023-01-20T19:11:55.956Z</atom:updated>
            <content:encoded><![CDATA[<h3>Swift on Windows — Part 2 (Docker Container)</h3><p>This tutorial will help you run Swift inside of Windows Docker Container.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dQ8Yf-9GnTtTSvoLFR5k9Q.png" /><figcaption>Docker on Windows</figcaption></figure><p>One of the challenges when setting up Swift on Windows native is the requirement to install underlying dependencies on all machines with agents installed to run CI/CD.</p><p>Docker provides an easier solution to this problem and handles the entire installation in a single click.</p><h4>Prerequisite</h4><ol><li><strong>Install Docker Desktop</strong></li></ol><p>Download Docker Desktop on a Windows machine by downloading its executable from <a href="https://docs.docker.com/desktop/install/windows-install/">Docker’s official page</a>. Follow below steps to install it.</p><ol><li>Double-click <strong>Docker Desktop Installer.exe</strong> to run the installer.</li><li>When prompted, ensure the <strong>Use WSL 2 instead of Hyper-V</strong> option on the Configuration page is selected or not depending on your choice of backend.</li><li>Follow the instructions on the installation wizard to authorize the installer and proceed with the installation.</li><li>When the installation is successful, click <strong>Close</strong> to complete the installation process.</li><li>If your admin account is different from your user account, you must add the user to the <strong>docker-users</strong> group. Run <strong>Computer Management</strong> as an <strong>administrator</strong> and navigate to <strong>Local Users and Groups</strong> &gt; <strong>Groups</strong> &gt; <strong>docker-users</strong>. Right-click to add the user to the group. Log out and log back in for the changes to take effect.</li></ol><p><strong>2. Start Docker Desktop</strong></p><p>Docker Desktop does not start automatically after installation. To start Docker Desktop:</p><ol><li>Search for Docker, and select <strong>Docker Desktop</strong> in the search results.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/0*29mqF5Dx-Xv3plOP.png" /><figcaption>Docker Desktop in Windows machine</figcaption></figure><p>2. Select <strong>Accept</strong> to continue. Docker Desktop starts after you accept the terms.</p><p><strong>3. Switch Container — This is an important step</strong></p><ol><li>Once Docker Desktop has been set up and started successfully, close it.</li><li>Right click the Docker icon in the Windows tray, and select <strong>Switch to Windows containers.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8mY8SIEL-16Ou_abeulETg.png" /><figcaption>Switching between Windows/Linux Container</figcaption></figure><p>3. To use the command line to switch between containers, then run</p><blockquote>&amp; $Env:ProgramFiles\Docker\Docker\DockerCli.exe -SwitchDaemon.</blockquote><p><strong>DockerFile</strong></p><p>Once the above prerequisites have been met, you can run any Windows- based container on the machine. Swift image can be pulled directly from Docker Hub using following command:</p><pre>docker pull swift</pre><p>If you have a custom requirement such as cloning a git repository, which requires ssh-key setup, you need an image that configures ssh-key for a container. To do so, you can copy contents from below attached Dockerfile, paste it in a text file, name it as Dockerfile(case-sensitive)and add or remove steps based on your requirement before creating a container out of it.</p><pre># escape=`<br><br>FROM mcr.microsoft.com/windows/servercore:ltsc2022 AS windows<br><br>LABEL maintainer=&quot;Swift Infrastructure &lt;swift-infrastructure@forums.swift.org&gt;&quot;<br>LABEL description=&quot;Docker Container for the Swift programming language&quot;<br><br>ARG GIT=https://github.com/git-for-windows/git/releases/download/v2.35.1.windows.2/Git-2.35.1.2-64-bit.exe<br>ARG INSTALLER=https://download.swift.org/swift-5.7-release/windows10/swift-5.7-RELEASE/swift-5.7-RELEASE-windows10.exe<br>ARG PYTHON=https://www.python.org/ftp/python/3.10.4/python-3.10.4-amd64.exe<br><br># restore the default Windows shell for correct batch processing<br>SHELL [&quot;cmd&quot;, &quot;/S&quot;, &quot;/C&quot;]<br><br># Install Visual Studio Build Tools<br>RUN                                                                             `<br>  curl -SLo vs_buildtools.exe https://aka.ms/vs/17/release/vs_buildtools.exe    `<br>  &amp;&amp; (start /w vs_buildtools.exe --quiet --wait --norestart --nocache           `<br>        --add Microsoft.VisualStudio.Component.Windows11SDK.22000               `<br>        --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64                 `<br>      || IF &quot;%EXITCODE%&quot;==&quot;3010&quot; EXIT 0)                                        `<br>  &amp;&amp; del /q vs_buildtools.exe<br><br># Install Swift toolchain.<br>RUN                                                                             `<br>  curl -SLo installer.exe %INSTALLER%                                           `<br>  &amp;&amp; (start /w installer.exe -q)                                                `<br>  &amp;&amp; del /q installer.exe<br><br># Install Git.<br># See: git-[version]-[bit].exe /SAVEINF=git.inf and /?<br>RUN                                                                             `<br>  curl -SLo git.exe %GIT%                                                       `<br>  &amp;&amp; (start /w git.exe /SP- /VERYSILENT /SUPPRESSMSGBOXES /NOCANCEL /NORESTART /CLOSEAPPLICATIONS /FORCECLOSEAPPLICATIONS /NOICONS /COMPONENTS=&quot;gitlfs&quot; /EditorOption=VIM /PathOption=Cmd /SSHOption=OpenSSH /CURLOption=WinSSL /UseCredentialManager=Enabled /PerformanceTweaksFSCache=Enabled /EnableSymlinks=Enabled /EnableFSMonitor=Enabled ) `<br>  &amp;&amp; del /q git.exe<br>  <br># Create an user and configure GIT ssh-key<br>RUN powershell -Command `<br>  net user /add ensemble; `<br>  net localgroup Administrators ensemble /add;<br>USER ensemble<br>RUN powershell -Command `<br>  mkdir C:\Users\ensemble\.ssh;<br>RUN powershell -Command `<br>  mkdir C:\Users\ensemble\swift;<br><br>COPY .\id_ed25519  C:\Users\ensemble\.ssh\id_rsa<br><br>RUN powershell -Command `<br>  # Make sure you&#39;re running as an Administrator `<br>  Set-Service ssh-agent -StartupType Automatic; `<br>  Start-Service ssh-agent; `<br>  Get-Service ssh-agent; <br><br>RUN ssh-add C:\Users\ensemble\.ssh\id_rsa<br><br># Install Python.<br># See: https://docs.python.org/3.10/using/windows.html<br># FIXME: it appears that `PYTHONHOME` and `PYTHONPATH` are unset<br>RUN                                                                             `<br>  curl -SLo python.exe %PYTHON%                                                 `<br>  &amp;&amp; (start /w python.exe /quiet InstallAllUsers=1 AssociateFiles=0 PrependPath=1 Shortcuts=0 Include_doc=0 Include_debug=0 Include_dev=0 Include_exe=0 Include_launcher=0 InstallLauncherAllUsers=0 Include_lib=1 Include_pip=0 Include_symbols=0 Include_tcltk=0 Include_test=0 Include_tools=0 ) `<br>  &amp;&amp; del /q python.exe<br><br># Default to powershell<br># FIXME: we need to grant ContainerUser the SeCreateSymbolicLinkPrivilege<br># privilege so that it can create symbolic links.<br># USER ContainerUser<br>CMD [&quot;powershell.exe&quot;, &quot;-nologo&quot;, &quot;-ExecutionPolicy&quot;, &quot;Bypass&quot;]</pre><pre>Suggested versions of Visual Studio, Python and Git in above Dockerfile<br>have been refered from Swift Official Documentation(link attached below). <br>Please check correct version on Swift&#39;s official documentation <br>and update Dockerfile accordingly.</pre><p><a href="https://www.swift.org/download/#Windows">Swift.org</a></p><p>The docker image created from the above Dockerfile does following:</p><blockquote>Pulls base image as for <strong>Windows OS</strong></blockquote><blockquote>Downloads <strong>Git </strong>installer</blockquote><blockquote>Downloads<strong> Swift 5.7 </strong>installer</blockquote><blockquote>Downloads <strong>Python 3.10</strong> installer</blockquote><blockquote>Sets terminal to Windows cmd</blockquote><blockquote>Installs <strong>Visual Studio </strong>and required tools</blockquote><blockquote>Installs <strong>Swift Toolchain </strong>from downloaded swift installer</blockquote><blockquote>Installs<strong> Git </strong>from downloaded git installer</blockquote><blockquote>Adds an user ensemble and add it to Administrator group</blockquote><blockquote>Configures SSH key to access our stash repositories by copying ssh key from local machine(where docker is running) to docker container</blockquote><blockquote>Starts ssh-agent on the container</blockquote><blockquote>Installs <strong>Python</strong> from downloaded pyhton installer</blockquote><blockquote>Sets terminal to PowerShell in container</blockquote><p><strong>Docker Image</strong></p><p>To create an image out of the above Dockerfile :</p><ul><li>Save it with name <strong><em>Dockerfile</em></strong> on the machine or agent where container has to be created</li><li>This docker file has a step that copies <em>id_rsa</em> from native machine to container. Before you build an image out of this Dockerfile, you need to copy <em>id-rsa</em> from machine’s .<em>ssh</em> folder to the folder where Dockerfile is saved.</li><li>Run following command to create a container from same path using <strong>PowerShell or cmd in admin mode</strong> where Dockerfile has been saved.</li></ul><p>docker build -t &lt;my_image_name&gt; .</p><p>It takes some time when building the first time because it pulls all base images and the terminal (Powershell or cmd) looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RneuPAzCc1_rTuMXwgv56w.png" /><figcaption>Building Docker Image from Dockerfile</figcaption></figure><p><strong>Docker Container</strong></p><p>Once an image has been created using above DockerFile:</p><ul><li>Click Run button corresponding to Docker image from Docker Desktop</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5pGHQMNgSZsqzgYMv_Q_vg.png" /><figcaption>Run Docker Image</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UiK5wI4sxDMdRwleR2CsHQ.png" /><figcaption>Container Properties</figcaption></figure><p>Once the container is up and running, you can run swift --version command inside container to check if container has Swift installed.</p><p>In order to run container from same image via Powershell or Command prompt, run following command using admin mode</p><p>docker run — interactive — tty — name &lt;container_name&gt; &lt;image_name&gt; cmd.exe</p><h3>Customizing Container</h3><p>If you made changes inside the container which can not be added to Dockerfile:</p><pre>For example: When I tried to clone a repository hosted on our corporate VPN, even though we had added ssh-key to the container, it asked to add permanently add stash to list of known hosts. After entring `Yes` to the prompt, the repository was cloned.<br>This particular step can not be defined in the image and has to be done inside container. <br>We can commit this change into a new image, so that when a container is created using this image, it retains this change.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vGy7oY3uQq-eBEYugy1slA.png" /><figcaption>Custom Changes in Container</figcaption></figure><p>To commit container changes into a new image, run following command in Powershell or Command Prompt using admin mode.</p><pre>docker commit &lt;container-id&gt; &lt;new-docker-image-name&gt;</pre><p>The image and container created as a result of above command will have all changes done in the previous container.</p><p>Further, you can push this image to the internal corporate docker hub or to the public docker hub so that others can use the same to create Swift-enabled containers on windows.</p><blockquote>Happy Swifting on Windows native and container!!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c3e1b197f17" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vmware-end-user-computing/swift-on-windows-part2-docker-container-4c3e1b197f17">Swift on Windows — Part2(Docker Container)</a> was originally published in <a href="https://medium.com/vmware-end-user-computing">VMware 360</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Swift on Windows — Part1(Native)]]></title>
            <link>https://medium.com/vmware-end-user-computing/swift-on-windows-part1-native-2e8a884a9513?source=rss-32507937fcd9------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e8a884a9513</guid>
            <category><![CDATA[windows-11]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Shalini ]]></dc:creator>
            <pubDate>Fri, 20 Jan 2023 19:10:01 GMT</pubDate>
            <atom:updated>2023-01-20T19:10:01.381Z</atom:updated>
            <content:encoded><![CDATA[<h3>Swift on Windows — Part 1 (Native)</h3><p>This tutorial series is to help you run your Swift code on Windows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3PZgwgR5mOj6UOvxiWiw0w.png" /><figcaption>Swift on Windows</figcaption></figure><p>In this tutorial we will :</p><ul><li>Understand the purpose of Swift on Windows</li><li>Install prerequisite software on Windows</li><li>Install Swift on Windows</li><li>Install WSL on windows</li></ul><p><strong>Why?</strong></p><p>While Swift-based projects are usually built and run on Mac machines, it can also be helpful to install Swift on Windows.</p><p>Infrastructure as Code (IaC) can be written in any language. In our case, our solution is written in Swift which manages and provisions our CI/CD configuration through code. This enables us to require peer reviews for any change to CI configuration before it is introduced in CI/CD process. CI/CD may run on any Apple, Linux, and Windows-based machine depending on the project requirement, which makes it important for us to provide support for all these platforms</p><p><strong>Prerequisites</strong></p><pre>Suggested versions of Visual Studio, Python and Git have been <br>refered from Swift&#39;s Official Documentation (link attached below). <br>Please check the correct version on Swift&#39;s official documentation <br>before you install them.</pre><p><a href="https://www.swift.org/download/#Windows">Swift.org</a></p><ol><li><strong>Git</strong></li></ol><p>Using Windows Powershell in admin mode, run the following command to install <strong>Git.</strong></p><blockquote>winget install Git.Git</blockquote><p><strong>2. Python</strong></p><p>Using Windows Powershell in admin mode, run the following command to install <strong>Python.</strong></p><blockquote>winget install Python.Python.3.9</blockquote><p>If `No package found matching criteria` error is received, search available versions using command `winget search &lt;app_name&gt;` and install available version</p><p>In a new Windows command prompt (non-admin), run the following command to install <strong>Python libraries</strong>.</p><blockquote>pip install six</blockquote><p><strong>3. VS Studio</strong></p><p>Using Windows command prompt in normal mode, run the following command to download <strong>Microsoft Visual Studio.</strong></p><blockquote>curl -sOL <a href="https://aka.ms/vs/16/release/vs_community.exe">https://aka.ms/vs/16/release/vs_community.exe</a></blockquote><p>Then proceed with the following to install it.</p><blockquote>start /w vs_community.exe --passive --wait --norestart --nocache ^</blockquote><blockquote>--installPath &quot;%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community&quot; ^</blockquote><blockquote>--add Microsoft.VisualStudio.Component.Windows10SDK.19041 ^</blockquote><blockquote>--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64</blockquote><p>Once Visual Studio has been installed, you may delete its installer by running the following command:</p><blockquote>del /q vs_community.exe</blockquote><p>After installing, open Microsoft Visual Studio Installer from <strong>Settings&gt;Apps</strong> in Windows Machine. In Visual Studio Installer, click on the Modify tab and choose the Individual Components tab. You will then install the following components</p><ol><li>Windows 10 SDK(10.0.17763.0)</li><li>Python 3 64-bit (3.7.8)</li><li>MSVC v142 - VS 2019 C++ x64/x86 build tools (Latest)</li><li>Git for Windows</li></ol><p><strong>Install Swift on Windows</strong></p><p>Swift can be installed through the official installer directly or by using the Windows Package Manager. Notice that the Windows Package Manager release may be behind the official release.</p><ol><li>When using the official installer which can be downloaded from the <a href="https://www.swift.org/download/">latest package release</a>, run the package installer and follow the steps.</li><li>When using Windows Powershell in admin mode, run the following command:</li></ol><p><em>winget install Swift.Toolchain</em></p><p>Swift ToolChain Installation Location</p><p><em>A Swift toolchain will be installed at </em><em>%SystemDrive%\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain.</em></p><p><em>A compatible Swift SDK will be installed at </em><em>%SystemDrive%\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk.</em></p><p>Once installed, you can run</p><pre>swift --version</pre><p>to validate Swift installation on the machine. Now your Windows machine is ready to compile and run your swift libraries.</p><p><strong>Additionally, </strong>you may need to run Linux-style commands on Windows. You can install WSL(Windows Subsystem for Linux).</p><p><strong>WSL</strong></p><p>Using the Windows command prompt in normal mode, run the following command to view a list of available WSL distros.</p><blockquote><em>wsl -l -o</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pasEjzhkXj507BDcAn4eEA.png" /><figcaption>List Linux Distribution</figcaption></figure><p>Using Windows command prompt in normal mode, run the following command to install the <em>WSL with a specific distro (Ubuntu in my case).</em></p><blockquote>wsl --install -d &lt;DISTRO-NAME&gt;</blockquote><blockquote>For e.g. : <em>wsl --install -d Ubuntu</em></blockquote><ol><li>Restart your computer to finish the WSL installation on Windows.</li><li>Search for the installed Linux Distribution on the system and double-click to launch it.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nj55vjb8rRGFFSZQAIIWkw.png" /><figcaption>Linux Distribution in Windows Machine</figcaption></figure><p>3. Configure username and password and it&#39;s ready to use.</p><p>In <a href="https://medium.com/vmware-end-user-computing/swift-on-windows-part2-docker-container-4c3e1b197f17">Part 2</a>, we will run Swift on Windows Docker Container.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e8a884a9513" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vmware-end-user-computing/swift-on-windows-part1-native-2e8a884a9513">Swift on Windows — Part1(Native)</a> was originally published in <a href="https://medium.com/vmware-end-user-computing">VMware 360</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>