Skip to content

Commit

Permalink
Merge pull request #33 from fhsinchy/hugo
Browse files Browse the repository at this point in the history
Hugo
  • Loading branch information
fhsinchy committed Jun 19, 2023
2 parents 5edf06e + cb80729 commit 270cb7b
Show file tree
Hide file tree
Showing 67 changed files with 272 additions and 2,708 deletions.
3 changes: 0 additions & 3 deletions .gitbook/assets/simultaneously-running-containers.svg

This file was deleted.

78 changes: 78 additions & 0 deletions .github/workflows/hugo.yaml
@@ -0,0 +1,78 @@
# Sample workflow for building and deploying a Hugo site to GitHub Pages
name: deploy

on:
# Runs on pushes targeting the default branch
push:
branches:
- master

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

# Default to bash
defaults:
run:
shell: bash

jobs:
# Build job
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.111.3
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass Embedded
run: sudo snap install dart-sass-embedded
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
- name: Build with Hugo
env:
# For maximum backward compatibility with Hugo modules
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
hugo \
--gc \
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./public

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
3 changes: 3 additions & 0 deletions .gitmodules
@@ -0,0 +1,3 @@
[submodule "themes/hugo-book"]
path = themes/hugo-book
url = https://github.com/alex-shpak/hugo-book
Empty file added .hugo_build.lock
Empty file.
15 changes: 0 additions & 15 deletions SUMMARY.md

This file was deleted.

6 changes: 6 additions & 0 deletions archetypes/default.md
@@ -0,0 +1,6 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

17 changes: 11 additions & 6 deletions README.md → content/_index.md
@@ -1,6 +1,11 @@
---
title: The Docker Handbook
type: docs
---

# The Docker Handbook

![](.gitbook/assets/docker-handbook-preview.png)
![](docker-handbook-preview.png)

The concept of containerization itself is pretty old, but the emergence of the [Docker Engine](https://docs.docker.com/get-started/overview/#docker-engine) in 2013 has made it much easier to containerize your applications.

Expand All @@ -21,23 +26,23 @@ As in-demand as it may be, getting started can seem a bit intimidating at first.

Code for the example projects can be found in the following repository:

{% embed url="https://github.com/fhsinchy/docker-handbook-projects/" caption="spare a ⭐ to keep me motivated" %}
[https://github.com/fhsinchy/docker-handbook-projects/](https://github.com/fhsinchy/docker-handbook-projects/)

You can find the complete code in the [completed](https://github.com/fhsinchy/docker-handbook-projects/tree/completed) branch.

## Contributions

This article is completely open-source and quality contributions are more than welcomed. You can find the full content in the following repository:

{% embed url="https://github.com/fhsinchy/the-docker-handbook" caption="spare a ⭐ to keep me motivated" %}
[https://github.com/fhsinchy/the-docker-handbook](https://github.com/fhsinchy/the-docker-handbook)

I usually do my changes and updates on the GitBook version of the article first and then publish them on freeCodeCamp. You can find the always updated and often incomplete version of the article in the following link:
I usually do my changes and updates on the GitHub version of the article first and then publish them on freeCodeCamp. You can find the always updated and often incomplete version of the article in the following link:

{% embed url="https://docker-handbook.farhan.dev/" caption="don\'t forget to leave a ⭐" %}
[https://docker-handbook.farhan.dev/](https://docker-handbook.farhan.dev/)

If you're looking for the complete and stable version of the article then freeCodeCamp will be the best place to go:

{% embed url="https://www.freecodecamp.org/news/the-docker-handbook/" caption="sharing with others may help" %}
[https://www.freecodecamp.org/news/the-docker-handbook/](https://www.freecodecamp.org/news/the-docker-handbook/)

Which ever version of the article you end up reading though, don't forget to let me know your opinion. Constructive criticism is always welcomed.

Expand Down
File renamed without changes
@@ -1,3 +1,9 @@
---
title: Composing Projects Using Docker-Compose
type: docs
weight: 9
---

# Composing Projects Using Docker-Compose

In the previous section, you've learned about managing a multi-container project and the difficulties of it. Instead of writing so many commands, there is an easier way to manage multi-container projects, a tool called [Docker Compose](https://docs.docker.com/compose/).
Expand Down Expand Up @@ -320,7 +326,7 @@ If you've cloned the project code repository, then go inside the `fullstack-note

Before we start with the `docker-compose.yaml` file let's look at a diagram of how the application is going to work:

![](.gitbook/assets/fullstack-application-design.svg)
![](fullstack-application-design.svg)

Instead of accepting requests directly like we previously did, in this application, all the requests will be first received by a NGINX \(lets call it router\) service. The router will then see if the requested end-point has `/api` in it. If yes, the router will route the request to the back-end or if not, the router will route the request to the front-end.

Expand Down Expand Up @@ -522,7 +528,7 @@ docker-compose --file docker-compose.yaml up --detach

Now visit `http://localhost:8080` and voilà!

![](.gitbook/assets/notes-application.png)
![](notes-application.png)

Try adding and deleting notes to see if the application works properly or not. The project also comes with shell scripts and a `Makefile`. Explore them to see how you can run this project without the help of `docker-compose` like you did in the previous section.

File renamed without changes
6 changes: 6 additions & 0 deletions conclusion.md → content/docs/conclusion.md
@@ -1,3 +1,9 @@
---
title: Conclusion
type: docs
weight: 10
---

# Conclusion

I would like to thank you from the bottom of my heart for the time you've spent reading this book. I hope you've enjoyed it and have learned all the essentials of Docker.
Expand Down
@@ -1,3 +1,9 @@
---
title: Container Manipulation Basics
type: docs
weight: 4
---

# Container Manipulation Basics

In the previous sections, you've learned about the building blocks of Docker and have also run a container using the `docker run` command. In this section, you'll be learning about container manipulation in a lot more detail. Container manipulation is one of the most common task you'll be performing every single day so having a proper understanding of the various commands is crucial.
Expand Down Expand Up @@ -60,7 +66,7 @@ When you wrote `--publish 8080:80` in the previous sub-section, it meant any req

Now to access the application on your browser, visit `http://127.0.0.1:8080` address.

![](.gitbook/assets/hello-dock.png)
![](hello-dock.png)

The container can be stopped by simply hitting `ctrl + c` key combination while the terminal window is in focus or closing off the terminal window completely.

Expand Down Expand Up @@ -216,7 +222,7 @@ docker container start hello-dock-container

Now you can ensure that the container is running by looking at the list of running containers using the `container ls` command. The `container start` command starts any container in detached mode by default and retains any port configurations made previously. So if you visit `http://127.0.0.1:8080` now, you should be able to access the `hello-dock` application just like before.

![](.gitbook/assets/hello-dock.png)
![](hello-dock.png)

Now, in scenarios where you would like to reboot a running container you may use the `container restart` command. The `container restart` command follows the exact syntax as the `container start` command.

Expand Down Expand Up @@ -443,7 +449,7 @@ In the previous section, I briefly mentioned executable images. These images are

Take for example my [rmbyext](https://github.com/fhsinchy/rmbyext) project. This is a simple python script capable of recursively deleting files of given extensions. To learn more about the project, you can checkout the repository:

{% embed url="https://github.com/fhsinchy/rmbyext" caption="spare a ⭐ to keep me motivated" %}
[https://github.com/fhsinchy/rmbyext](https://github.com/fhsinchy/rmbyext)

If you have both git and python installed, you can install this script by executing the following command:

Expand Down
File renamed without changes

0 comments on commit 270cb7b

Please sign in to comment.