From aa149fcf5c976f9f04f368c148f41ba8dfa9fa8d Mon Sep 17 00:00:00 2001 From: CaffeineFueled Date: Sun, 6 Oct 2024 18:09:25 +0200 Subject: [PATCH] init setup --- Dockerfile | 19 +++++++++++++++++++ README.md | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..46bfbf3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM ubuntu:24.04 as base + +RUN apt-get update && \ + apt-get install -y wget && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* +WORKDIR /tmp/hugo + +ARG TARGETARCH=amd64 +ARG HUGO_VERSION=0.135.0 + +RUN wget -O "hugo.tar.gz" --progress=dot:giga "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-${TARGETARCH}.tar.gz" + +RUN tar -xf "hugo.tar.gz" hugo -C /usr/bin && \ + cp /tmp/hugo/hugo /usr/bin/hugo + +WORKDIR /content +ENTRYPOINT ["hugo"] + diff --git a/README.md b/README.md new file mode 100644 index 0000000..3f0da25 --- /dev/null +++ b/README.md @@ -0,0 +1,35 @@ +# Creating Docker Container for Hugo + +Hugo 0.135.0 - amd64 - Ubuntu 24.04 + +*Replace Docker with Podman - been using Podman* + +## Build Container + +`git clone https://git.ittavern.com/CaffeineFueled/hugo-docker.git` + +`cd hugo-docker` + +`podman build -t hugo-docker:0.135.0 .` + +Run hugo commands like this: + +```bash +podman run --rm \ + -p 1313:1313 \ + -v $PWD:/content \ + localhost/hugo-docker:0.135.0 \ + server --bind 0.0.0.0 +``` + +*Run in directory with Hugo page* + +Add to config: + +`alias hugo="podman run --rm -p 1313:1313 -v $PWD:/content localhost/hugo-docker:0.135.0"` + +*Create alias for the latest version* + +# Official Docker Image + +They just announced a tagged [Hugo Docker Image](https://github.com/gohugoio/hugo/pkgs/container/hugo/280590856?tag=v0.135.0) in their [Release Notes of the current version](https://github.com/gohugoio/hugo/releases/tag/v0.135.0). You should use the offiicial Docker Image! - This a learning projects.