Use docker-compose #28
3
.gitignore
vendored
|
@ -5,3 +5,6 @@
|
|||
# Hugo stuff
|
||||
public
|
||||
resources
|
||||
|
||||
# from docker build
|
||||
_site
|
||||
|
|
6
Dockerfile_hugo
Normal file
|
@ -0,0 +1,6 @@
|
|||
FROM debian:buster-slim
|
||||
RUN apt-get update && \
|
||||
apt-get upgrade -y && \
|
||||
apt-get install -y wget && \
|
||||
wget https://github.com/gohugoio/hugo/releases/download/v0.80.0/hugo_extended_0.80.0_Linux-64bit.deb -O hugo.deb && \
|
||||
dpkg -i hugo.deb
|
15
README.md
|
@ -5,8 +5,17 @@ data.coop-website
|
|||
|
||||
This is a [Hugo](https://gohugo.io/) project.
|
||||
|
||||
Running locally
|
||||
---------------
|
||||
Running with Docker
|
||||
-------------------
|
||||
|
||||
In `docker-compose.yml`, we have specified a `serve` target which you can run locally like this:
|
||||
|
||||
``` {.sourceCode .bash}
|
||||
docker-compose up serve
|
||||
```
|
||||
|
||||
Running without Docker
|
||||
----------------------
|
||||
|
||||
Go to [Hugo Github release](https://github.com/gohugoio/hugo/releases)
|
||||
and fetch the latest package for **hugo\_extended** for your system.
|
||||
|
@ -18,7 +27,7 @@ Example recipe
|
|||
|
||||
``` {.sourceCode .bash}
|
||||
# Fetch .deb from Github
|
||||
wget https://github.com/gohugoio/hugo/releases/download/v0.80.0/hugo_extended_0.80.0_Linux-64bit.deb -O hugo_extended.deb
|
||||
wget https://github.com/gohugoio/hugo/releases/download/v0.80.0/hugo_extended_X.Y.Z_Linux-64bit.deb -O hugo_extended.deb
|
||||
benjaoming marked this conversation as resolved
|
||||
|
||||
# Install package
|
||||
sudo dpkg -i hugo_extended.deb
|
||||
|
|
31
docker-compose.yml
Normal file
|
@ -0,0 +1,31 @@
|
|||
version: "3"
|
||||
services:
|
||||
|
||||
build:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile_hugo
|
||||
command: |
|
||||
/bin/bash -c "
|
||||
cd /code
|
||||
hugo --destination _site/
|
||||
"
|
||||
volumes:
|
||||
- .:/code
|
||||
|
||||
|
||||
serve:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile_hugo
|
||||
command: |
|
||||
/bin/bash -c "
|
||||
cd /code
|
||||
hugo serve
|
||||
benjaoming marked this conversation as resolved
Outdated
laumann
commented
If I understand hugo correctly, then Per
I think using the built-in server is fine, as I don't think performance is a big concern right now. I could be missing something though... If I understand hugo correctly, then `hugo serve` uses the built-in server, and will build and serve everything from memory. So I don't think the build step is really necessary.
Per `hugo server --help`:
> Hugo provides its own webserver which builds and serves the site.
> While hugo server is high performance, it is a webserver with limited options.
> Many run it in production, but the standard behavior is for people to use it
> in development and use a more full featured server such as Nginx or Caddy.
I think using the built-in server is fine, as I don't think performance is a big concern right now.
I could be missing something though...
benjaoming
commented
It's only for development, yeah. The actual building is in It's only for development, yeah. The actual building is in `.drone.yml`.
laumann
commented
But then you could just omit the whole But then you could just omit the whole `build` service, right?
benjaoming
commented
Ah yes, correct, I'll remove it, it's confusing. Ah yes, correct, I'll remove it, it's confusing.
|
||||
"
|
||||
ports:
|
||||
- "1313:1313"
|
||||
network_mode: "host"
|
||||
volumes:
|
||||
- .:/code
|
||||
|
[nit] The Dockerfile calls it
hugo.deb
but the docs sayhugo_extended.deb
- not a big point though.This is also just manual instructions for someone that wants to run Hugo without Docker. I can imagine it can be easier for some folks that will find Docker discouraging. Like "what is even Docker!?" would maybe be the reaction of a frontend design who'd want to help :)
I get that. I want to live without Docker :-)
I do too sometimes.. if dependencies are few and they are trustworthy .debs, it's fine for me at times.