<?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 Levent Ege Mutlu on Medium]]></title>
        <description><![CDATA[Stories by Levent Ege Mutlu on Medium]]></description>
        <link>https://medium.com/@legemutlu?source=rss-26c83ec014bd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*eeXU0pxYgQbKAEgq0MfrAw.jpeg</url>
            <title>Stories by Levent Ege Mutlu on Medium</title>
            <link>https://medium.com/@legemutlu?source=rss-26c83ec014bd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 11:14:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@legemutlu/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[How To Containerize Angular Applications with Docker]]></title>
            <link>https://medium.com/piateamtech/how-to-containerize-angular-applications-with-docker-afc4859e468?source=rss-26c83ec014bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/afc4859e468</guid>
            <category><![CDATA[deploy]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[containerization]]></category>
            <dc:creator><![CDATA[Levent Ege Mutlu]]></dc:creator>
            <pubDate>Thu, 11 Nov 2021 12:34:40 GMT</pubDate>
            <atom:updated>2021-11-12T07:13:56.830Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YIKieihdkVPutk87.png" /></figure><h3>Hi Fellas! 👋🏽</h3><p>What do you do when you need to build Angular in another environment? You are free to say It’s working on my computer or use a container of docker instead. Docker is an open-source platform for building, deploying, and managing containerized applications. Docker containers can simplify the process of building and deploying Angular applications. In this post, we’ll learn how to containerize angular applications with docker.</p><p>This post is divided into the following parts:</p><ul><li>Create Angular App</li><li>Create Dist Folder</li><li>Create Dockerfile</li><li>Build Docker and run</li></ul><h3>So, First We Need an Angular Application</h3><p>I’m going to create an Angular Application, and first, we have to install <a href="https://nodejs.org/en/">Node</a> which is a Javascript Runtime Environment.</p><p>We need <a href="https://docs.npmjs.com/getting-started">NPM</a> (Node Package Manager). NPM is a package manager for the JavaScript programming language. We’ll use npm to install packages or libraries.</p><p>Then, we’ll generate a new Angular project using the <a href="https://angular.io/cli">Angular CLI</a>. Install it globally (with the -g flag) using your command line:</p><pre>npm install -g @angular/cli</pre><p>Now, we can create an Angular Application using the command line, my project name is angular-docker, and you are free to pick a name to your liking.</p><p>Create the application using ng new command:</p><pre>ng new angular-docker</pre><p>After creating the Angular Application, we go through the project folder and run the application:</p><pre>ng serve</pre><p>When you see the &#39;✅ Compiled successfully&#39; message in your command line, check the URL http://localhost:4200/.</p><p>You will see this default welcome page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pZJHsIuoxgdcJ7gv.png" /></figure><p>Congrats! We got a working angular application.</p><p>The first part of the post is done, fellas!! 💪🏽</p><h3>Let’s Create a Dist Folder</h3><p>The first thing to do is to build the application and the dist folder will be created. In Angular, this is just as simple as running the following command:</p><pre>ng build --prod</pre><p>When the dist folder is created, you can see static files in the dist folder. These files are everything you need to show your application to the outside world.</p><p>If you haven’t struggled so far, we can continue with the rest of the post.</p><h3>Create Dockerfile</h3><p>First, we start with creating a Dockerfile in the route directory of the project.</p><p>We create a layer from the node: latest Docker image with FROM.</p><blockquote>I use node latest version, you can use node specific version as node:16.13.0</blockquote><pre>FROM node:latest as node</pre><p>Bundle everything inside an application folder which is called app using the below command.</p><pre>WORKDIR /app</pre><p>Copy package.json and package-lock.json files of our local application folder to this app folder inside the Docker container. Then run npm install.</p><pre>COPY package.json package-lock.json ./<br>RUN npm install</pre><p>Copy every file.</p><pre>COPY . .</pre><p>And build our project.</p><pre>RUN npm run build --prod</pre><p>Alpine is the base image that is based on Alpine Linux. So, node: alpine is an Alpine Linux image with node the latest version installed.</p><pre>FROM nginx:alpine<br>COPY --from=node /app/dist/angular-docker usr/share/nginx/html</pre><p>All Dockerfile instructions used above are gathered here:</p><pre>FROM node:latest as node<br>WORKDIR /app<br>COPY package.json package-lock.json ./<br>RUN npm install<br>COPY . .<br>RUN npm run build --prod</pre><pre>FROM nginx:alpine<br>COPY --from=node /app/dist/angular-docker usr/share/nginx/html</pre><h3>And Finally, Build Docker and Run</h3><p>So, let’s build and run the application with the Docker command angular-docker:</p><pre>docker build -t angular-docker .<br>docker run -d -p 4200:80 angular-docker</pre><p>💥 Let’s check <a href="http://localhost:4200/">http://localhost:4200/</a> and see the running application. That’s sort of magic and docker.</p><h3>So, that’s all folks. We got an application that is working in a docker container.</h3><h3>Good luck with that!🤟🏾</h3><p>If you want to follow my future posts you can check out <a href="https://lege-blog.vercel.app/">my website</a> 💪🏽</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=afc4859e468" width="1" height="1" alt=""><hr><p><a href="https://medium.com/piateamtech/how-to-containerize-angular-applications-with-docker-afc4859e468">How To Containerize Angular Applications with Docker</a> was originally published in <a href="https://medium.com/piateamtech">Pia-Team Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>