Update local container development

This commit is contained in:
christianbraeunlich 2021-12-18 15:43:40 +01:00
parent a6dd49aa9d
commit 7457fe6d78

View file

@ -1,11 +1,17 @@
+++
chapter = true
pre = "<b><i class='fas fa-clone'></i> </b>"
title = "Containerizing"
title = "Local Container Development"
weight = 100
+++
# Containerizing
# Local Container Development
- [Abstract](#abstract)
- [Requirements](#requirements)
- [How to get started](#how-to-get-started)
- [Run the container](#run-the-container)
- [Update on changes](#update-on-changes)
## Abstract
@ -13,26 +19,33 @@ Nowadays it's common practice to have an environment up-and-running at your loca
This allows us a better reviewing of our own code answering the question "How it would look like after the deployment?"
## Requirements
- Git
- Docker Desktop
## How to get started
First of all we need to have the themes/relearn properly loaded. Most likely you have already cloned the repository. In this case use:
First of all we need to have the themes/relearn properly loaded. Most likely you have already cloned the repository but without the `--recursive` option. In this case use `git submodule update --init --recursive` from within your cloned repository folder.
`git submodule update --init --recursive`
If you are wondering how to clone repository with all submodules by default the `git clone --recursive` argument will serve your needs.
If you are wondering how to clone the submodules by default the `--recursive` will serve your needs.
Last but not least you need to change your Docker Desktop to **"Switch to Linux containers..."** in order to [Run the container](#run-the-container).
## Run the container
By executing the following command, you will have your local alguidelines hugo server up-and-running:
```docker run --rm -it -p 1313:1313 -v ${PWD}:/src klakegg/hugo:latest "server --buildDrafts --watch --bind 0.0.0.0"```
```docker run --rm -it -p 1313:1313 -v ${PWD}:/src klakegg/hugo:latest "server --bind 0.0.0.0"```
## FAQ
After everything is successful you will be able to see your local alguidelines hugo at http://localhost:1313.
#### 1. I get the following Error when I try to run the container "Error building site: "/src/content/Contributing/ForkAndPR/index.md:14:1": failed to extract shortcode: template for shortcode "notice" not found"
Note: you have to execute this command from within your cloned alguidlines repo.
> Cloning the themes/relearn project solves this error: `git submodule update --init --recursive`.
## Update on changes
#### 2. I made some changes in the documentation but they are not shown to me in my local hugo environment.
1. In the terminal **Press Ctrl+c to stop**.
> Consider building the image and running your local docker container again.
2. Press **Arrow-Up Key** or run the command as in [Run the container](#run-the-container).
3. **Reload** the browser tab