<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>kevinpollet.dev</title><link>https://kevinpollet.dev/</link><description>kevinpollet.dev</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>kevinpollet</copyright><lastBuildDate>Thu, 17 Oct 2019 00:00:00 +0000</lastBuildDate><atom:link href="https://kevinpollet.dev/index.xml" rel="self" type="application/rss+xml"/><item><title>Introducing seel</title><link>https://kevinpollet.dev/posts/introducing-seel/</link><pubDate>Thu, 17 Oct 2019 00:00:00 +0000</pubDate><guid>https://kevinpollet.dev/posts/introducing-seel/</guid><description>&lt;p>I&amp;rsquo;m impatient and thrilled to introduce &lt;a href="https://github.com/kevinpollet/seel">seel&lt;/a>, a command-line tool to containerize your &lt;strong>Node.js&lt;/strong> application
without effort. Not all developers are Docker/container experts and containerizing an application is not a simple task.
For example, you will have to:&lt;/p>
&lt;ul>
&lt;li>Write a &lt;a href="https://docs.docker.com/engine/reference/builder/">Dockerfile&lt;/a>&lt;/li>
&lt;li>Follow the security best practices&lt;/li>
&lt;li>Build the smallest image possible&lt;/li>
&lt;li>Optimize the Docker build cache&lt;/li>
&lt;li>Define a tagging strategy (e.g. &lt;a href="https://semver.org/">semantic versioning&lt;/a>, git commit hash)&lt;/li>
&lt;li>Write and maintain build and publish scripts&lt;/li>
&lt;/ul>
&lt;h2 id="focus-on-your-application-seel-takes-care-of-the-containerization" >Focus on your application, seel takes care of the containerization
&lt;span>
&lt;a href="#focus-on-your-application-seel-takes-care-of-the-containerization">
&lt;svg viewBox="0 0 28 23" height="100%" width="19" xmlns="http://www.w3.org/2000/svg">&lt;path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" fill="none" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/>&lt;path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" fill="none" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/>&lt;/svg>
&lt;/a>
&lt;/span>
&lt;/h2>&lt;p>To simplify this &lt;strong>seel&lt;/strong> uses opinionated, but configurable, defaults based on the properties defined in the
application &lt;code>package.json&lt;/code> (e.g. name, version, bin/main scripts, description, &amp;hellip;).&lt;/p>
&lt;p>The following screencast shows the containerization of an application created from scratch with &lt;code>npm&lt;/code> (more examples are
available &lt;a href="https://github.com/kevinpollet/seel#examples">here&lt;/a>).&lt;/p>
&lt;p>&lt;img src="./screencast.svg" alt="screencast">&lt;/p>
&lt;h2 id="some-features" >Some features
&lt;span>
&lt;a href="#some-features">
&lt;svg viewBox="0 0 28 23" height="100%" width="19" xmlns="http://www.w3.org/2000/svg">&lt;path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" fill="none" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/>&lt;path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" fill="none" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/>&lt;/svg>
&lt;/a>
&lt;/span>
&lt;/h2>&lt;ul>
&lt;li>Tree shaking, only the entry module dependencies are packaged&lt;/li>
&lt;li>Automatic image tagging with &lt;a href="https://semver.org/">semantic versioning&lt;/a>&lt;/li>
&lt;li>Automatic image labelling (description, maintainer, version)&lt;/li>
&lt;li>Secure private package registry configuration&lt;/li>
&lt;li>Optimized Docker build cache&lt;/li>
&lt;/ul>
&lt;h2 id="whats-next" >What&amp;rsquo;s next?
&lt;span>
&lt;a href="#whats-next">
&lt;svg viewBox="0 0 28 23" height="100%" width="19" xmlns="http://www.w3.org/2000/svg">&lt;path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" fill="none" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/>&lt;path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" fill="none" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/>&lt;/svg>
&lt;/a>
&lt;/span>
&lt;/h2>&lt;p>&lt;strong>seel&lt;/strong> is actively developed and at its early stages. If you want to test it, file bugs, request a feature or
contribute some code, go to the &lt;a href="https://github.com/kevinpollet/seel">GitHub repository&lt;/a> and don&amp;rsquo;t miss to give some 💚 and support with a ⭐.&lt;/p></description></item><item><title>How to use your .dockerignore as a whitelist</title><link>https://kevinpollet.dev/posts/how-to-use-your-dockerignore-as-a-whitelist/</link><pubDate>Sat, 10 Aug 2019 00:00:00 +0000</pubDate><guid>https://kevinpollet.dev/posts/how-to-use-your-dockerignore-as-a-whitelist/</guid><description>&lt;p>Many tools use ignore files to exclude files from build, process or publish steps (e.g. &lt;code>.npmignore&lt;/code> for
npm, &lt;code>.gitignore&lt;/code> for Git and &lt;code>.dockerignore&lt;/code> for Docker). As your project grows, evolves, it can be hard to maintain
the exclusion patterns and, as a side effect, you can expose unwanted or sensitive files. Using your &lt;code>.dockerignore&lt;/code> as
a whitelist can be an elegant option to avoid these mistakes and to reduce the effort to keep things up to date.&lt;/p>
&lt;h2 id="whats-the-dockerignore-for" >What&amp;rsquo;s the .dockerignore for?
&lt;span>
&lt;a href="#whats-the-dockerignore-for">
&lt;svg viewBox="0 0 28 23" height="100%" width="19" xmlns="http://www.w3.org/2000/svg">&lt;path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" fill="none" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/>&lt;path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" fill="none" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/>&lt;/svg>
&lt;/a>
&lt;/span>
&lt;/h2>&lt;p>When you&amp;rsquo;re creating a Docker image, the very first step is to define the build &lt;a href="https://docs.docker.com/engine/reference/builder/">instructions&lt;/a> in a Dockerfile. The
second step is to run the &lt;code>docker build PATH&lt;/code> command from the Docker CLI. The &lt;code>PATH&lt;/code> argument is the path to the folder
containing your Dockerfile. As a result, the Docker CLI will send the build context to the Docker daemon.&lt;/p>
&lt;h3 id="the-build-context" >The build context
&lt;span>
&lt;a href="#the-build-context">
&lt;svg viewBox="0 0 28 23" height="100%" width="19" xmlns="http://www.w3.org/2000/svg">&lt;path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" fill="none" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/>&lt;path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" fill="none" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/>&lt;/svg>
&lt;/a>
&lt;/span>
&lt;/h3>&lt;p>Every file and folder within the given &lt;code>PATH&lt;/code> are &lt;code>tar&lt;/code>d by the Docker CLI and sent to the Docker daemon. These files
and folders compose the build context. Your Docker image will be built with this context, so unwanted files sent to the
daemon can be packaged by error in the final image with the &lt;code>ADD&lt;/code> or &lt;code>COPY&lt;/code> instructions.&lt;/p>
&lt;p>Also, the Docker daemon can be executed on a remote machine, so it&amp;rsquo;s better to avoid sending large, unnecessary and
sensitive files to it.&lt;/p>
&lt;p>Remember, &lt;code>ADD&lt;/code> and &lt;code>COPY&lt;/code> instructions are run by the daemon and never by the CLI, so they are not used to remove
unwanted files from the build context.&lt;/p>
&lt;h3 id="exclude-files-from-the-build-context" >Exclude files from the build context
&lt;span>
&lt;a href="#exclude-files-from-the-build-context">
&lt;svg viewBox="0 0 28 23" height="100%" width="19" xmlns="http://www.w3.org/2000/svg">&lt;path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" fill="none" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/>&lt;path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" fill="none" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/>&lt;/svg>
&lt;/a>
&lt;/span>
&lt;/h3>&lt;p>When you invoke the &lt;code>docker build&lt;/code> command, the Docker CLI looks for a file named &lt;code>.dockerignore&lt;/code> in the root folder of
the build context (i.e. in the root folder of the given &lt;code>PATH&lt;/code>). If this file exists, every file and folder matching
the &lt;a href="https://docs.docker.com/engine/reference/builder/#dockerignore-file">exclusion patterns&lt;/a> will not be included in the &lt;code>tar&lt;/code> archive sent to the Docker daemon. The Docker build will
be faster and the risk of packaging unwanted files reduced.&lt;/p>
&lt;p>For example, if you want to exclude the &lt;code>.git&lt;/code> folder and all markdown files from the build context, add the following
content to your &lt;code>.dockerignore&lt;/code>:&lt;/p>
&lt;pre tabindex="0">&lt;code>.git
*.md
&lt;/code>&lt;/pre>&lt;h2 id="use-your-dockerignore-as-a-whitelist" >Use your .dockerignore as a whitelist
&lt;span>
&lt;a href="#use-your-dockerignore-as-a-whitelist">
&lt;svg viewBox="0 0 28 23" height="100%" width="19" xmlns="http://www.w3.org/2000/svg">&lt;path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" fill="none" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/>&lt;path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" fill="none" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/>&lt;/svg>
&lt;/a>
&lt;/span>
&lt;/h2>&lt;p>Blacklist vs whitelist is a long debate and, I think, both types have its use case. From my experience, you&amp;rsquo;ll have more
files to exclude from your build context than to include, so to keep things clean and secure, whitelisting files is less
error-prone.&lt;/p>
&lt;p>If you&amp;rsquo;ve read the &lt;code>.dockerignore&lt;/code> &lt;a href="https://docs.docker.com/engine/reference/builder/#dockerignore-file">documentation&lt;/a>, you may have noticed the following lines:&lt;/p>
&lt;blockquote>
&lt;p>Finally, you may want to specify which files to include in the context, rather than which to exclude. To achieve this, specify * as the first pattern, followed by one or more! exception patterns.&lt;/p>
&lt;/blockquote>
&lt;p>Pretty easy!&lt;/p>
&lt;p>As an example, the following &lt;code>.dockerignore&lt;/code> instructs the Docker CLI to exclude everything excepted the &lt;code>JS&lt;/code> files
within the &lt;code>lib&lt;/code> folder from the build context:&lt;/p>
&lt;pre tabindex="0">&lt;code># Ignore everything
*
# Allow files and folders with a pattern starting with !
!lib/**/*.js
&lt;/code>&lt;/pre>&lt;p>With a whitelist it&amp;rsquo;s also possible to publish unwanted or sensitive files from a whitelisted folder but, in my opinion,
this issue is minor.&lt;/p>
&lt;h2 id="summary" >Summary
&lt;span>
&lt;a href="#summary">
&lt;svg viewBox="0 0 28 23" height="100%" width="19" xmlns="http://www.w3.org/2000/svg">&lt;path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" fill="none" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/>&lt;path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" fill="none" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/>&lt;/svg>
&lt;/a>
&lt;/span>
&lt;/h2>&lt;p>Now that you know how to blacklist or whitelist files with your &lt;code>.dockerignore&lt;/code>, choose the best option for your use
case. To conclude, using your &lt;code>.dockerignore&lt;/code> as a whitelist allows to:&lt;/p>
&lt;ul>
&lt;li>Exclude by default everything from the build context&lt;/li>
&lt;li>Reduce the size of the &lt;code>tar&lt;/code> archive sent to the Docker daemon&lt;/li>
&lt;li>Reduce the risk of packaging unwanted or sensitive files in your Docker image&lt;/li>
&lt;li>Reduce the effort to keep exclusion patterns up to date&lt;/li>
&lt;/ul>
&lt;p>PS: You can use the same trick with your &lt;code>.gitignore&lt;/code> or &lt;code>.npmignore&lt;/code>. For npm, the best practice is to use
the &lt;a href="https://docs.npmjs.com/files/package.json#files">files&lt;/a> property in your &lt;code>package.json&lt;/code> instead of a &lt;code>.npmignore&lt;/code> file.&lt;/p></description></item><item><title>The beginning of my blogging journey</title><link>https://kevinpollet.dev/posts/the-beginning-of-my-blogging-journey/</link><pubDate>Sun, 28 Jul 2019 00:00:00 +0000</pubDate><guid>https://kevinpollet.dev/posts/the-beginning-of-my-blogging-journey/</guid><description>&lt;p>As said in the description, every journey has a beginning and here is a little write-up for the beginning of my blogging
journey. In the past I&amp;rsquo;ve created many blogs but nothing was publicly available or updated because I was not satisfied
by the result. As a therapy and to improve my writing skills, I will try to post articles on a regular basis on
things I&amp;rsquo;ve learned or hacked during my developer journey, which have started 10 years ago, even if it&amp;rsquo;s not perfect in
my point of view.&lt;/p>
&lt;blockquote>
&lt;p>The best is the enemy of the good — Voltaire&lt;/p>
&lt;/blockquote></description></item><item><title>About Me</title><link>https://kevinpollet.dev/about/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://kevinpollet.dev/about/</guid><description>&lt;p>Hey, I am Kevin, an enthusiast open-source developer, currently working at &lt;a href="https://traefik.io/">Traefik Labs&lt;/a>. I am
working on &lt;a href="https://github.com/traefik/traefik#readme">Traefik Proxy&lt;/a>
and &lt;a href="https://github.com/traefik/mesh#readme">Traefik Mesh&lt;/a> and multiple things to make networking boring.&lt;/p>
&lt;p>I have been programming for a long time, and I am passionate about everything related to Go, Network, Containers, Cloud,
and Distributed systems.&lt;/p>
&lt;p>Last but not least, I am also a space cat lover!&lt;/p></description></item></channel></rss>