<?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 Blair VanderLugt on Medium]]></title>
        <description><![CDATA[Stories by Blair VanderLugt on Medium]]></description>
        <link>https://medium.com/@blair.v?source=rss-73aeb997992b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*4wHyCWmP1g3p7hjqd-mfZg.jpeg</url>
            <title>Stories by Blair VanderLugt on Medium</title>
            <link>https://medium.com/@blair.v?source=rss-73aeb997992b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 13:52:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@blair.v/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[Deploying create-react-app to Azure Web App Service]]></title>
            <link>https://medium.com/@blair.v/deploying-create-react-app-to-azure-web-app-service-2ce7871fcbe?source=rss-73aeb997992b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ce7871fcbe</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[azure-web-app]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Blair VanderLugt]]></dc:creator>
            <pubDate>Wed, 29 Apr 2020 02:19:19 GMT</pubDate>
            <atom:updated>2020-04-29T02:19:19.397Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Boappyfjl6M-0bvx" /><figcaption>Photo by <a href="https://unsplash.com/@jeremybishop?utm_source=medium&amp;utm_medium=referral">Jeremy Bishop</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This is a guide to setting up a create-react-app with Docker and deploying to Azure Web App Containers via Azure Container Service. I am using a single container to host a react app and defining a Docker container. This container is hosted on Azure Web Apps using their container offering. Along the way I will talk about using the VS Code extensions for Docker and Web App ad how to use them effectively during development. Let’s go!</p><ul><li><a href="https://reactjs.org/docs/create-a-new-react-app.html">Create React App</a></li><li><a href="https://www.docker.com/products/docker-desktop">Docker for Desktop</a></li><li><a href="https://code.visualstudio.com/docs/containers/overview">VS Code with the Docker extension installed</a></li></ul><h3>Create React App</h3><p>We will start with creating a react app</p><pre>npx create-react-app myapp</pre><p>Test it with</p><pre>npm start</pre><h3>Dockerize Your App</h3><pre>touch Dockerfile</pre><p>Now edit that file to include the definition of your container. If you are new to Docker one of the most important tricks to working with Docker container’s effectively is taking advantage of caching layers. A container is built by reading your Dockerfile line-by-line. Each line adds layer to your image and the results are cached for subsequent builds. Take advantage of this by placing configuration that do not change often at the top, like your image choice and any os configurations, and then copy in your application code at the bottom:</p><pre>FROM node:10</pre><pre>RUN npm install -g serve # A simple webserver</pre><pre>WORKDIR /usr/src/app</pre><pre>COPY package*.json ./</pre><pre>RUN npm install</pre><pre>COPY . .</pre><pre>RUN npm run build</pre><pre>EXPOSE 3000</pre><pre>CMD [&quot;serve&quot;, &quot;-s&quot;, &quot;build&quot;, &quot;-l&quot;, &quot;3000&quot;]</pre><p>For this example we are using a base image with node and a very easy to use web server from Serve. Notice that we copy the package.json file which lists all of the dependencies and then install them before copying the app code. This allows docker to cache your dependencies and re-use them during subsequent builds as long as the package.json hasn’t changed. Last we build the app, expose the app’s port (configured in create-react-app), and start it up. Note that “build” is the default directory where create-react-app drops the build output.</p><p>Now we build the image</p><pre>docker build -f &quot;Dockerfile&quot; --tag myapp .</pre><p>To test your image locally in VS Code use Command Palette -&gt; Docker: Run and the container name or tag you want to run.</p><p>OR</p><pre>docker run --rm -p 3000:3000 myapp</pre><p>The port maping of -p 3000:3000 forwards the exposed port 3000 on the docker container to your system port 3000. If you open a browser and navigate to localhost:3000 or 127.0.0.1:3000 you should see the create-react-app demo landing page.</p><p>Great! VSCode makes this super easy but it also adds a bunch of other features.</p><p>The container logs can be viewed by going to the Docker extension in the sidebar, right clicking the image and selecting ‘view logs’. The logs for the container execution will be printed to your integrated terminal. This is very helpful for taking a quick peek into the inner workings of your container.</p><p>This completes the local dev experience we can now push our container up to Azure Container Registry and deploy it from there to Web Apps</p><h3>Set up a container registry</h3><p>Azure Web Apps consumes container images from a container registry. You can use Docker Hub, a private registry or Azure Container Registry. ACR is a great choice because it integrates with Azure Web Apps and setting it up is really easy.</p><p><a href="https://docs.microsoft.com/en-us/azure/container-registry/container-registry-get-started-portal">Quickstart - Create registry in portal - Azure Container Registry</a></p><p>Now that you have a registry lets push our image to it. Our registry can contain many repositories each defining a container. To get our container up to ACR we create a registry and push the image there.</p><p>First login to ACR either using the VS Code Docker extension or</p><pre>az acr login --name myregistry</pre><p>Now let’s tag our image with the registry that we want to push to. You will need the name of your registry and it will take the form myresgistry.azurecr.io.</p><pre>docker tag myapp myregistry.azurecr.io/myapp:latest</pre><p>This tag tells Docker where to push your image, in this case, a registry called myregistry at azurecr.io. Azure will create repository called myapp:latest for you.</p><h3>Azure Web App</h3><p>So this last bit is delightfully easy given the integration that the VS Code Docker extension provides.</p><p>Navigate to the Docker extension in VS Code and under the registry sidebar right click the container under the registry. Select ‘Deploy Image to Azure App Service’. Complete the prompts that VS Code displays to specifying the details of the new App Service.</p><p>And that’s it, your new App Service is being deployed. Navigate to the Azure portal and you should find your new App Service. The URL should be displayed in the overview.</p><p>If you go find the registry that you set up you can browse the webhooks section to see how the container image is linked the web app. Using this hook every time you push a new image to your registry endpoint the Web App will be updated with your new code.</p><p>Pretty damn slick.</p><h3>References</h3><p><a href="https://docs.microsoft.com/en-us/azure/app-service/containers/app-service-linux-intro">https://docs.microsoft.com/en-us/azure/app-service/containers/app-service-linux-intro</a></p><p><a href="https://docs.microsoft.com/en-us/azure/app-service/containers/quickstart-docker">https://docs.microsoft.com/en-us/azure/app-service/containers/quickstart-docker</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ce7871fcbe" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>