From f60a5a5e9c30e26f9413f5c30221f78a2e65900d Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Tue, 4 May 2021 20:57:45 +0200 Subject: [PATCH 1/2] Run stuff with docker-compose --- .gitignore | 3 +++ Dockerfile_hugo | 6 ++++++ README.md | 15 ++++++++++++--- docker-compose.yml | 31 +++++++++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 Dockerfile_hugo create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore index a009d9f..2e05adb 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ # Hugo stuff public resources + +# from docker build +_site diff --git a/Dockerfile_hugo b/Dockerfile_hugo new file mode 100644 index 0000000..06a4f48 --- /dev/null +++ b/Dockerfile_hugo @@ -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 diff --git a/README.md b/README.md index d20288b..3e8e1aa 100644 --- a/README.md +++ b/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 # Install package sudo dpkg -i hugo_extended.deb diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c1a591c --- /dev/null +++ b/docker-compose.yml @@ -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 + " + ports: + - "1313:1313" + network_mode: "host" + volumes: + - .:/code + -- 2.43.4 From 95ad580bb8a02e45f848bf624eb97f2b0bbe5187 Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Tue, 4 May 2021 22:30:06 +0200 Subject: [PATCH 2/2] Remove redundant build service --- docker-compose.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c1a591c..a46fad9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,19 +1,6 @@ version: "3" services: - build: - build: - context: . - dockerfile: Dockerfile_hugo - command: | - /bin/bash -c " - cd /code - hugo --destination _site/ - " - volumes: - - .:/code - - serve: build: context: . -- 2.43.4