<?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: Sven Hoffmann</title>
    <description>The latest articles on DEV Community by Sven Hoffmann (@sven).</description>
    <link>https://dev.to/sven</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%2F132519%2F46fec9f4-413d-47f5-9c0d-a3972b47abf9.jpg</url>
      <title>DEV Community: Sven Hoffmann</title>
      <link>https://dev.to/sven</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sven"/>
    <language>en</language>
    <item>
      <title>Automate Building &amp; Pushing Docker Containers Using GitHub Actions</title>
      <dc:creator>Sven Hoffmann</dc:creator>
      <pubDate>Thu, 20 Jun 2019 13:32:45 +0000</pubDate>
      <link>https://dev.to/sven/automate-building-pushing-docker-containers-using-github-actions-202j</link>
      <guid>https://dev.to/sven/automate-building-pushing-docker-containers-using-github-actions-202j</guid>
      <description>&lt;p&gt;Welcome to my second article! It took a while, but I hope you will enjoy this one.&lt;/p&gt;

&lt;p&gt;You might think, "Docker containers? What are those?" My apologies, but I won't explain what containers are in this article. That said, I was thinking about writing a beginner friendly series about containers and serverless computing. So if you would be interested in such a thing, please let me know!&lt;/p&gt;

&lt;p&gt;Today I'm gonna walk you through on how to automatically build and push containers defined in your GitHub repository to your &lt;a href="https://hub.docker.com/" rel="noopener noreferrer"&gt;Docker Hub&lt;/a&gt; account using &lt;a href="https://github.com/features/actions" rel="noopener noreferrer"&gt;GitHub Actions&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Using this method, you can keep your Docker Hub images in sync with your repository. Every time you push to the repository, the container will be built and pushed to the Docker Hub.&lt;/p&gt;

&lt;h1&gt;
  
  
  Let's bake a cake
&lt;/h1&gt;

&lt;p&gt;To make this all a bit easier to follow, we're going to pretend we are reading a recipe. I will first list all the ingredients (requirements) and then I will explain the process using more detailed steps.&lt;/p&gt;

&lt;h1&gt;
  
  
  Ingredients
&lt;/h1&gt;

&lt;p&gt;(Also known as &lt;em&gt;requirements&lt;/em&gt;.)&lt;/p&gt;

&lt;h4&gt;
  
  
  You will need:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;A GitHub account that has access to GitHub Actions (you can request access &lt;a href="https://github.com/features/actions" rel="noopener noreferrer"&gt;here&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;A repository that has access to GitHub Actions&lt;/li&gt;
&lt;li&gt;A valid &lt;code&gt;Dockerfile&lt;/code&gt; in your repository&lt;/li&gt;
&lt;li&gt;A Docker Hub account&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Let's automate!
&lt;/h1&gt;

&lt;p&gt;Got all the ingredients? Awesome!&lt;br&gt;
Let's use GitHub Actions to automate building and pushing your container to Docker Hub.&lt;/p&gt;

&lt;p&gt;First, navigate to your repository and click on &lt;code&gt;Actions&lt;/code&gt; at the top.&lt;br&gt;
You'll end up in an interface similar to this one. Create a new workflow file.&lt;br&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%2Fusv1mepsruth8ck1vgfc.png" 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%2Fusv1mepsruth8ck1vgfc.png" alt="GitHub Actions create a new workflow"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We'll create a workflow that runs when someone pushes something to the repository.&lt;br&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%2Fhhrs14vzbkdk7jv9dhaa.png" 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%2Fhhrs14vzbkdk7jv9dhaa.png" alt="GitHub Actions configure workflow"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Drag the blue connector down and add the 'Docker Registry' action.&lt;br&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%2Fsv27untseku6y9hunbxy.png" 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%2Fsv27untseku6y9hunbxy.png" alt="GitHub Actions add Docker Registry action"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This action will log you in to the Docker Hub using the &lt;code&gt;DOCKER_USERNAME&lt;/code&gt; and &lt;code&gt;DOCKER_PASSWORD&lt;/code&gt; secrets. Add your username and password as a secret. Be careful! Don't add them as an environment variable, otherwise they will be visible!&lt;br&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%2Faismw9sxl7nmfbjzzfrk.png" 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%2Faismw9sxl7nmfbjzzfrk.png" alt="Adding secrets to the Docker Registry action"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next up, add another action below the 'Docker Registry' action. This time we will use the 'GitHub Actions for Docker' action. Using this action you are able to run Docker commands like you would in your terminal.&lt;br&gt;
The command you want to run needs to go into the &lt;code&gt;args&lt;/code&gt; field. The action will automatically put &lt;code&gt;docker&lt;/code&gt; in front of your command, so make sure you don't.&lt;/p&gt;

&lt;p&gt;Let's pretend we would build and push our container in the terminal for a second.&lt;/p&gt;

&lt;p&gt;Before we are able to push the container we need to build it first. To do this we would use the command &lt;code&gt;docker build -t [username]/[container name] [path to Dockerfile]&lt;/code&gt;&lt;br&gt;
For my &lt;a href="https://github.com/sven-zo/actions-docker-hub-demo" rel="noopener noreferrer"&gt;example repository&lt;/a&gt; this would be: &lt;code&gt;docker run build -t svenzo/actions-docker-hub-demo src&lt;/code&gt;. If your Dockerfile is in the root of the repository, you can put a &lt;code&gt;.&lt;/code&gt; (dot) instead of the folder path.&lt;/p&gt;

&lt;p&gt;The second command we would run is the push command: &lt;code&gt;docker push [username]/[container name]&lt;/code&gt;. Once again, for my &lt;a href="https://github.com/sven-zo/actions-docker-hub-demo" rel="noopener noreferrer"&gt;example repository&lt;/a&gt; this will be as follows: &lt;code&gt;docker push svenzo/actions-docker-hub-demo&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To make these commands work in the &lt;code&gt;args&lt;/code&gt; field we need to remove the first &lt;code&gt;docker&lt;/code&gt; in front of the command, and combine both commands using &lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt;. You will end up with something like this: &lt;code&gt;build -t [username]/[container name] [path to Dockerfile] &amp;amp;&amp;amp; docker push [username]/[container name]&lt;/code&gt;.&lt;br&gt;
For my &lt;a href="https://github.com/sven-zo/actions-docker-hub-demo" rel="noopener noreferrer"&gt;example repository&lt;/a&gt; this will be: &lt;code&gt;build -t svenzo/actions-docker-hub-demo src &amp;amp;&amp;amp; docker push svenzo/actions-docker-hub-demo&lt;/code&gt;.&lt;br&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%2Fdgcnyknr6v7vfrz8pa1b.png" 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%2Fdgcnyknr6v7vfrz8pa1b.png" alt="GitHub Actions for Docker"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, commit the workflow file using the menu at the top right.&lt;br&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%2F7r6xq407shlpfz8wx4yn.png" 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%2F7r6xq407shlpfz8wx4yn.png" alt="Commit"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you wait a few seconds and navigate to the &lt;code&gt;Actions&lt;/code&gt; tab, you will see your actions running. If everything goes well, the container in your repository will be pushed to your Docker Hub account. If something went wrong, you will be able to look into the logs to check what went wrong.&lt;br&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%2Fuxj6ch6cgt4ajty9i3wp.png" 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%2Fuxj6ch6cgt4ajty9i3wp.png" alt="GitHub Actions success"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can navigate to your Docker Hub account and see the container image GitHub Actions pushed for you.&lt;br&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%2F0n8lh0ye3mz60ih3s1si.png" 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%2F0n8lh0ye3mz60ih3s1si.png" alt="Docker Hub success"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Final thoughts
&lt;/h1&gt;

&lt;p&gt;Hey, did you enjoy reading this article? I hope you found this tutorial useful. Please let me know what you think in the comments. Additionally, I was thinking  on writing a beginner friendly series of articles on the subject of 'containers and serverless'. Would you be interested? Please let me know as well!&lt;/p&gt;

&lt;p&gt;Anyways, &lt;a href="https://song.link/i/284000387" rel="noopener noreferrer"&gt;here's a song you might like&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;See you soon, and take care ✌&lt;br&gt;
~ Sven&lt;/p&gt;




&lt;h1&gt;
  
  
  Attribution
&lt;/h1&gt;

&lt;p&gt;Banner image background by &lt;a href="https://unsplash.com/photos/pSyfecRCBQA" rel="noopener noreferrer"&gt;Kyle Ryan&lt;/a&gt; on Unsplash&lt;br&gt;
GitHub icon made by &lt;a href="https://www.flaticon.com/authors/icomoon" rel="noopener noreferrer"&gt;Icomoon&lt;/a&gt; from &lt;a href="https://www.flaticon.com/" rel="noopener noreferrer"&gt;Flaticon&lt;/a&gt;&lt;br&gt;
Docker icon made by &lt;a href="https://icons8.com" rel="noopener noreferrer"&gt;Icons8&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Thanks for reading! Leave a like ❤ or a comment 🖊 if you want to. And most importantly; don't give up if GitHub Actions isn't working like you'd want to!&lt;/p&gt;

</description>
      <category>devops</category>
      <category>docker</category>
      <category>ci</category>
      <category>github</category>
    </item>
    <item>
      <title>Why I Struggled with Creating an Account Here and Why I Did It</title>
      <dc:creator>Sven Hoffmann</dc:creator>
      <pubDate>Thu, 07 Feb 2019 23:08:37 +0000</pubDate>
      <link>https://dev.to/sven/why-i-struggled-with-creating-an-account-here-and-why-i-did-it-5ah</link>
      <guid>https://dev.to/sven/why-i-struggled-with-creating-an-account-here-and-why-i-did-it-5ah</guid>
      <description>&lt;p&gt;Today I'll be telling you the story of my struggles with creating an account here. 'What struggles', you ask? Well... let me tell you.&lt;/p&gt;

&lt;h1&gt;
  
  
  The technical struggle
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Chapter 1: Commuting
&lt;/h2&gt;

&lt;p&gt;When I found out a friend posted some pretty cool posts on this site I thought; 'Wow! I want to like those posts to support them!'.&lt;/p&gt;

&lt;p&gt;I was on my mobile device at the time, commuting home. So I went to 'dev.to' on my mobile device and pressed the 'Log in via GitHub' button.&lt;/p&gt;

&lt;p&gt;And..!&lt;/p&gt;

&lt;p&gt;Nothing happened.&lt;br&gt;
I was unable to log in via GitHub.&lt;/p&gt;

&lt;p&gt;The 'Log in via Twitter' button did work, by the way. But at the time I didn't know you could log in using both methods. Since I don't use Twitter often I'd rather log in with GitHub.&lt;/p&gt;

&lt;p&gt;'It must be because of my mobile browser', I thought, 'let's try again at home'.&lt;/p&gt;

&lt;h2&gt;
  
  
  Chapter 2: At home
&lt;/h2&gt;

&lt;p&gt;So at home, I tried again. With multiple browsers. Without any success.&lt;/p&gt;

&lt;p&gt;I was lost.&lt;br&gt;
I wasn't sure what to do.&lt;br&gt;
And I just wanted to like some posts. ❤&lt;/p&gt;

&lt;p&gt;Without any motivation left, I went to bed.&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%2Funsplash.com%2Fphotos%2Fxg8z_KhSorQ%2Fdownload%3Fforce%3Dtrue" 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%2Funsplash.com%2Fphotos%2Fxg8z_KhSorQ%2Fdownload%3Fforce%3Dtrue" alt="Sunrise"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The following day I was still kinda bummed out I couldn't create an account. But I was determined again. I was gonna like those posts!&lt;/p&gt;

&lt;p&gt;So I logged in using Twitter.&lt;br&gt;
And it worked!&lt;/p&gt;

&lt;p&gt;And I was happy. On the other hand, I was still kind of frustrated the GitHub login button didn't work. &lt;em&gt;At all.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Satisfied after liking those posts I wanted to like, I went and explored the site some more.&lt;/p&gt;

&lt;p&gt;This is when I saw it.&lt;br&gt;
I saw &lt;strong&gt;the solution&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Chapter 3: The solution (kind of)
&lt;/h2&gt;

&lt;p&gt;In the settings screen, I saw that you could link your GitHub account as well. And... this button actually worked!&lt;/p&gt;

&lt;p&gt;I was happy. This way, I could log in using both methods!&lt;/p&gt;

&lt;p&gt;To this day I still wonder why the 'Log in using GitHub' button is broken for signing up. Am I the only one facing this problem?&lt;/p&gt;

&lt;h1&gt;
  
  
  The personal struggle
&lt;/h1&gt;

&lt;p&gt;I had a personal struggle with creating an account as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Committing
&lt;/h2&gt;

&lt;p&gt;No, not the &lt;a href="https://git-scm.com/docs/git-commit" rel="noopener noreferrer"&gt;git&lt;/a&gt; kind. I was scared that if I made an account here, I'd have to commit to commenting and writing all the time. And that can be quite scary! It's not always easy either, with English being my second language. Then again, the best way to practice is just to get out there and get feedback. So, I did. And now we're here.&lt;/p&gt;

&lt;h1&gt;
  
  
  But I made it
&lt;/h1&gt;

&lt;p&gt;In the end, I did create a profile! And if everything goes well, this will be my first post. I hope I can share some of my knowledge with you all, or at least entertain you with my posts. 😃&lt;/p&gt;

&lt;h2&gt;
  
  
  Being part of a community
&lt;/h2&gt;

&lt;p&gt;One of the big reasons I went through all that trouble to create an account is that I don't feel like I'm part of the 'developer community' at times. This is not true of course, but perhaps if I partake more in the community it will feel less alien to me. Being a lurker is fine, but I hope this helps to ground me.&lt;/p&gt;

&lt;h2&gt;
  
  
  A friend inspired me
&lt;/h2&gt;

&lt;p&gt;A friend of mine has an account here as well. I saw that they posted some awesome articles! I wondered if I could share some of my experiences as well.&lt;br&gt;
I realised the only way I'd find out is by just diving straight in and trying it out myself.&lt;/p&gt;

&lt;h1&gt;
  
  
  My story
&lt;/h1&gt;

&lt;p&gt;That's my story so far. What's yours? I'd love to know your reasons for signing up. Did you have any struggles as well? Or did you find it easy to start? Let me know!&lt;/p&gt;

&lt;p&gt;Anyways, &lt;a href="https://open.spotify.com/track/4GDhkAg959r5AL0hn1a7Zt" rel="noopener noreferrer"&gt;here's a song you might like&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;See you soon, and take care ✌&lt;br&gt;
~ Sven&lt;/p&gt;




&lt;h3&gt;
  
  
  Attribution
&lt;/h3&gt;

&lt;p&gt;Cactus picture by &lt;a href="https://unsplash.com/photos/C6oPXOatFD8" rel="noopener noreferrer"&gt;Scott Webb&lt;/a&gt; on Unsplash&lt;br&gt;
Sunrise picture by &lt;a href="https://unsplash.com/photos/xg8z_KhSorQ" rel="noopener noreferrer"&gt;OC Gonzalez&lt;/a&gt; on Unsplash&lt;br&gt;
Shout out to &lt;a href="https://dev.to/maniflames"&gt;@maniflames&lt;/a&gt; for being awesome.&lt;/p&gt;




&lt;p&gt;Thanks for reading! Leave a like ❤ or a comment 🖊 if you want to. And most importantly; don't give up if creating an account doesn't work!&lt;/p&gt;

</description>
      <category>writing</category>
      <category>beginners</category>
      <category>career</category>
      <category>meta</category>
    </item>
  </channel>
</rss>
