hugo docker & docker-compose ok
This commit is contained in:
parent
ae79133b69
commit
c9cf197d56
7
Dockerfile
Normal file
7
Dockerfile
Normal file
@ -0,0 +1,7 @@
|
||||
FROM nginx:alpine
|
||||
COPY ./public /var/www/html
|
||||
|
||||
# Literally copy nginx.conf file from the Dockerfile directory into /etc/nginx/conf.d/default.conf of the container
|
||||
COPY ./nginx/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
EXPOSE 80
|
71
README.md
71
README.md
@ -1,64 +1,19 @@
|
||||
# HUGO SITE AVEC DOCKER
|
||||
|
||||

|
||||
Cette branche à pour but de conteneurisé un site HUGO compilé avec un server NGINX.
|
||||
La configuration pour le NGINX reverse proxy en front se trouve dans le dossir nginx-proxy.
|
||||
|
||||
---
|
||||
## Attention, le nom de domaine est à configuré dans les deux fichier de NGINX !
|
||||
|
||||
Example [Hugo] website using GitLab Pages.
|
||||
### DOCKER
|
||||
|
||||
Learn more about GitLab Pages at https://pages.gitlab.io and the official
|
||||
documentation https://docs.gitlab.com/ce/user/project/pages/.
|
||||
```bash
|
||||
docker build -t hugo/hugo-site .
|
||||
docker run -d -p 6666:80 --name hugo-site hugo/hugo-site
|
||||
```
|
||||
|
||||
---
|
||||
### DOCKER-COMPOSE
|
||||
|
||||
## GitLab CI
|
||||
|
||||
This project's static Pages are built by [GitLab CI][ci], following the steps
|
||||
defined in [`.gitlab-ci.yml`](.gitlab-ci.yml).
|
||||
|
||||
## Building locally
|
||||
|
||||
To work locally with this project, you'll have to follow the steps below:
|
||||
|
||||
1. Fork, clone or download this project
|
||||
1. [Install][] Hugo
|
||||
1. Preview your project: `hugo server`
|
||||
1. Add content
|
||||
1. Generate the website: `hugo` (optional)
|
||||
|
||||
Read more at Hugo's [documentation][].
|
||||
|
||||
### Preview your site
|
||||
|
||||
If you clone or download this project to your local computer and run `hugo server`,
|
||||
your site can be accessed under `localhost:1313/hugo/`.
|
||||
|
||||
The theme used is adapted from http://themes.gohugo.io/beautifulhugo/.
|
||||
|
||||
## GitLab User or Group Pages
|
||||
|
||||
To use this project as your user/group website, you will need one additional
|
||||
step: just rename your project to `namespace.gitlab.io`, where `namespace` is
|
||||
your `username` or `groupname`. This can be done by navigating to your
|
||||
project's **Settings**.
|
||||
|
||||
You'll need to configure your site too: change this line
|
||||
in your `config.toml`, from `"https://pages.gitlab.io/hugo/"` to `baseurl = "https://namespace.gitlab.io"`.
|
||||
Proceed equally if you are using a [custom domain][post]: `baseurl = "http(s)://example.com"`.
|
||||
|
||||
Read more about [user/group Pages][userpages] and [project Pages][projpages].
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
1. CSS is missing! That means two things:
|
||||
|
||||
Either that you have wrongly set up the CSS URL in your templates, or
|
||||
your static generator has a configuration option that needs to be explicitly
|
||||
set in order to serve static assets under a relative URL.
|
||||
|
||||
[ci]: https://about.gitlab.com/gitlab-ci/
|
||||
[hugo]: https://gohugo.io
|
||||
[install]: https://gohugo.io/overview/installing/
|
||||
[documentation]: https://gohugo.io/overview/introduction/
|
||||
[userpages]: http://doc.gitlab.com/ee/pages/README.html#user-or-group-pages
|
||||
[projpages]: http://doc.gitlab.com/ee/pages/README.html#project-pages
|
||||
[post]: https://about.gitlab.com/2016/04/07/gitlab-pages-setup/#custom-domains
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Configuration de l'adresse, titre (onglet) et des chemins vers les contenus
|
||||
baseurl = "https://greglebreton.gitlab.io/hugo-site/"
|
||||
baseurl = "https://hugo.gregandev.fr"
|
||||
contentdir = "content"
|
||||
layoutdir = "layouts"
|
||||
publishdir = "public"
|
||||
|
10
docker-compose.yml
Normal file
10
docker-compose.yml
Normal file
@ -0,0 +1,10 @@
|
||||
version: '3.9'
|
||||
services:
|
||||
hugo2:
|
||||
image: nginx:alpine
|
||||
container_name: hugo-site2
|
||||
volumes:
|
||||
- ./nginx:/etc/nginx/conf.d
|
||||
- ./public:/var/www/html
|
||||
ports:
|
||||
- 6666:80
|
23
nginx-docker/nginx.conf
Normal file
23
nginx-docker/nginx.conf
Normal file
@ -0,0 +1,23 @@
|
||||
# config pour le nginx dans le caontainer
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
root /var/www/html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
error_page 404 /404.html; # Here and below is 404 error handling docs tried to describe
|
||||
location = /404.html {
|
||||
root /var/www/html;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /var/www/html;
|
||||
}
|
||||
|
||||
}
|
||||
|
43
nginx-proxy/nginx-proxy.conf
Normal file
43
nginx-proxy/nginx-proxy.conf
Normal file
@ -0,0 +1,43 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name example.com;
|
||||
|
||||
client_max_body_size 64M;
|
||||
|
||||
# Redirection HTTP -> HTTPS
|
||||
return 301 https://$host$request_uri;
|
||||
|
||||
}
|
||||
|
||||
server{
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
|
||||
server_name example.com;
|
||||
|
||||
location / {
|
||||
proxy_buffering off;
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $server_name;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_pass http://127.0.0.1:6666;
|
||||
}
|
||||
|
||||
# Nécessaire pour les redirections inetrnes à Hugo
|
||||
location /feed {
|
||||
return 302 https://example.com/index.xml;
|
||||
}
|
||||
|
||||
ssl on;
|
||||
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
|
||||
|
||||
access_log /var/log/nginx/hugo_access.log;
|
||||
error_log /var/log/nginx/hugo_error.log;
|
||||
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
- id: dateFormat
|
||||
translation: "2 Janvier, 2006"
|
||||
- id: postedOnDate
|
||||
#translation: "Posté le {{ .Count }}"
|
||||
translation: "Posté le "
|
||||
- id: translationsLabel
|
||||
translation: "Autres langues: "
|
||||
- id: translationsSeparator
|
||||
|
Loading…
x
Reference in New Issue
Block a user