<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: zabio3</title>
    <description>The latest articles on DEV Community by zabio3 (@zabio3).</description>
    <link>https://dev.to/zabio3</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F50258%2F0777b69e-af45-41a6-aa95-36c6ffab68a4.png</url>
      <title>DEV Community: zabio3</title>
      <link>https://dev.to/zabio3</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zabio3"/>
    <language>en</language>
    <item>
      <title>Dockerfile lint tool using moby buildkit parser</title>
      <dc:creator>zabio3</dc:creator>
      <pubDate>Sun, 17 Mar 2019 13:48:44 +0000</pubDate>
      <link>https://dev.to/zabio3/release-v001-godolint-golang-dockerfile-lint-tool-3f2h</link>
      <guid>https://dev.to/zabio3/release-v001-godolint-golang-dockerfile-lint-tool-3f2h</guid>
      <description>&lt;h1&gt;
  
  
  &lt;a href="https://github.com/zabio3/godolint"&gt;godolint&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;A Dockerfile linter that helps you build &lt;a href="https://docs.docker.com/develop/develop-images/dockerfile_best-practices/"&gt;best practice&lt;/a&gt; Docker images (inspired by &lt;a href="https://github.com/hadolint/hadolint"&gt;Haskell Dockerfile Linter&lt;/a&gt;). &lt;br&gt;
For static analysis of AST, &lt;a href="https://github.com/moby/buildkit/tree/master/frontend/dockerfile/parser"&gt;moby/buildkit parser&lt;/a&gt; is used, and lint check is done.&lt;br&gt;
This tool performs docker rule checks based on the parsed AST.&lt;/p&gt;
&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;

&lt;p&gt;You can run godolint locally to lint your Dockerfile.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ godolint &amp;lt;Dockerfile&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h5&gt;
  
  
  Example
&lt;/h5&gt;

&lt;p&gt;To check Dockerfile&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ godolint testdata/DL3000_Dockerfile
#3 DL3000 Use absolute WORKDIR. 

$ godolint testdata/DL3001_Dockerfile
#6 DL3001 For some bash commands it makes no sense running them in a Docker container like `ssh`, `vim`, `shutdown`, `service`, `ps`, `free`, `top`, `kill`, `mount`, `ifconfig`. 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Options
&lt;/h4&gt;

&lt;p&gt;You can set some options:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Available options:
  --ignore RULECODE     A rule to ignore. If present, the ignore list in the
                        config file is ignored

Other Commands:
  --help        -h      Help about any command
  --version     -v      Print the version information
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h5&gt;
  
  
  Example
&lt;/h5&gt;

&lt;p&gt;To check Dockerfile (exclude specific rules).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ godolint --ignore DL3000 testdata/DL3000_Dockerfile
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Install
&lt;/h2&gt;

&lt;p&gt;You can download binary from release page and place it in $PATH directory.&lt;/p&gt;

&lt;p&gt;Or you can use go get&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ go get github.com/zabio3/godolint
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Rules
&lt;/h2&gt;

&lt;p&gt;An implemented rules.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Rule&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3000"&gt;DL3000&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Use absolute WORKDIR.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3001"&gt;DL3001&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;For some bash commands it makes no sense running them in a Docker container like ssh, vim, shutdown, service, ps, free, top, kill, mount, ifconfig.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3002"&gt;DL3002&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Last user should not be root.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3003"&gt;DL3003&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Use WORKDIR to switch to a directory.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3004"&gt;DL3004&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Do not use sudo as it leads to unpredictable behavior. Use a tool like gosu to enforce root.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3005"&gt;DL3005&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Do not use apt-get upgrade or dist-upgrade.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3007"&gt;DL3007&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Using latest is prone to errors if the image will ever update. Pin the version explicitly to a release tag.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3006"&gt;DL3006&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Always tag the version of an image explicitly.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3008"&gt;DL3008&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Pin versions in apt-get install.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3009"&gt;DL3009&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Delete the apt-get lists after installing something.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3010"&gt;DL3010&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Use ADD for extracting archives into an image.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3011"&gt;DL3011&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Valid UNIX ports range from 0 to 65535.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3012"&gt;DL3012&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Provide an email address or URL as maintainer. (This rule is DEPRECATED and no longer active)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3013"&gt;DL3013&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Pin versions in pip.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3014"&gt;DL3014&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Use the &lt;code&gt;-y&lt;/code&gt; switch.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3015"&gt;DL3015&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Avoid additional packages by specifying --no-install-recommends.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3016"&gt;DL3016&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Pin versions in &lt;code&gt;npm&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3017"&gt;DL3017&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Do not use &lt;code&gt;apk upgrade&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3018"&gt;DL3018&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Pin versions in apk add. Instead of &lt;code&gt;apk add &amp;lt;package&amp;gt;&lt;/code&gt; use &lt;code&gt;apk add &amp;lt;package&amp;gt;=&amp;lt;version&amp;gt;&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3019"&gt;DL3019&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Use the &lt;code&gt;--no-cache&lt;/code&gt; switch to avoid the need to use &lt;code&gt;--update&lt;/code&gt; and remove &lt;code&gt;/var/cache/apk/*&lt;/code&gt; when done installing packages.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3020"&gt;DL3020&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Use &lt;code&gt;COPY&lt;/code&gt; instead of &lt;code&gt;ADD&lt;/code&gt; for files and folders.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3021"&gt;DL3021&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;COPY&lt;/code&gt; with more than 2 arguments requires the last argument to end with &lt;code&gt;/&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3022"&gt;DL3022&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;COPY --from&lt;/code&gt; should reference a previously defined &lt;code&gt;FROM&lt;/code&gt; alias.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3023"&gt;DL3023&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;COPY --from&lt;/code&gt; cannot reference its own &lt;code&gt;FROM&lt;/code&gt; alias.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3024"&gt;DL3024&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;FROM&lt;/code&gt; aliases (stage names) must be unique.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL3025"&gt;DL3025&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Use arguments JSON notation for CMD and ENTRYPOINT arguments.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL4000"&gt;DL4000&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;MAINTAINER is deprecated.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL4001"&gt;DL4001&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Either use Wget or Curl but not both.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL4003"&gt;DL4003&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Multiple &lt;code&gt;CMD&lt;/code&gt; instructions found.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL4004"&gt;DL4004&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Multiple &lt;code&gt;ENTRYPOINT&lt;/code&gt; instructions found.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL4005"&gt;DL4005&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Use &lt;code&gt;SHELL&lt;/code&gt; to change the default shell.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/hadolint/hadolint/wiki/DL4006"&gt;DL4006&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Set the &lt;code&gt;SHELL&lt;/code&gt; option -o pipefail before &lt;code&gt;RUN&lt;/code&gt; with a pipe in it.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  AST
&lt;/h3&gt;

&lt;p&gt;Dockerfile syntax is fully described in the &lt;a href="https://docs.docker.com/engine/reference/builder/"&gt;Dockerfile reference&lt;/a&gt;. &lt;br&gt;
Just take a look at &lt;a href="https://github.com/moby/buildkit/tree/master/frontend/dockerfile/parser"&gt;moby/buildkit&lt;/a&gt; in the language-docker project to see the AST definition.&lt;/p&gt;

&lt;h2&gt;
  
  
  Contribution
&lt;/h2&gt;

&lt;p&gt;Contributions are of course always welcome!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Fork zabio3/godolint (&lt;a href="https://github.com/zabio3/godolint/fork"&gt;https://github.com/zabio3/godolint/fork&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;go get&lt;/code&gt; to install dependencies&lt;/li&gt;
&lt;li&gt;Create a feature branch&lt;/li&gt;
&lt;li&gt;Commit your changes&lt;/li&gt;
&lt;li&gt;Run test using &lt;code&gt;go test ./...&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Create a Pull Request&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;See &lt;a href="https://github.com/zabio3/godolint/blob/master/CONTRIBUTING.md"&gt;&lt;code&gt;CONTRIBUTING.md&lt;/code&gt;&lt;/a&gt; for details.&lt;/p&gt;

</description>
      <category>dockerfile</category>
      <category>go</category>
      <category>lint</category>
      <category>docker</category>
    </item>
    <item>
      <title>Proxy and play with other people's site</title>
      <dc:creator>zabio3</dc:creator>
      <pubDate>Thu, 27 Dec 2018 09:00:41 +0000</pubDate>
      <link>https://dev.to/zabio3/proxy-and-play-with-other-peoples-site-k5k</link>
      <guid>https://dev.to/zabio3/proxy-and-play-with-other-peoples-site-k5k</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/zabio3/ngrok-openresty" rel="noopener noreferrer"&gt;ngrok-openresty&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ngrok-openresty is a tool that makes it easy to set proxy settings and publish them on the Internet.&lt;/p&gt;

&lt;p&gt;There are cases where you want to make simple tuning and publish it on the Internet and check the behavior.&lt;/p&gt;

&lt;p&gt;For example, checking with &lt;a href="https://developers.google.com/speed/pagespeed/insights/" rel="noopener noreferrer"&gt;PageSpeed Insights&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fumv0znqiteg6ol4igc3h.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fumv0znqiteg6ol4igc3h.gif" alt="demo"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ngrok</category>
      <category>nginx</category>
      <category>openresy</category>
    </item>
  </channel>
</rss>
