From daa49e47899b5ae99d0cbe448248fcba5ee49ac6 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Sun, 27 Oct 2024 18:26:37 -0500 Subject: [PATCH] Add Dockerfile --- Dockerfile | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3e10719 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,41 @@ +FROM docker.io/library/golang:1.23-alpine + +RUN apk add --no-cache \ + curl \ + gcc \ + g++ \ + musl-dev \ + build-base \ + libc6-compat + +ARG HUGO_VERSION + +RUN mkdir $HOME/src && \ + cd $HOME/src && \ + curl -L https://github.com/gohugoio/hugo/archive/refs/tags/v${HUGO_VERSION}.tar.gz | tar -xz && \ + cd "hugo-${HUGO_VERSION}" && \ + go install --tags extended + +FROM docker.io/library/golang:1.20-alpine + +RUN apk add --no-cache \ + runuser \ + git \ + openssh-client \ + rsync \ + npm && \ + npm install -D autoprefixer postcss-cli + +RUN mkdir -p /var/hugo && \ + addgroup -Sg 1000 hugo && \ + adduser -Sg hugo -u 1000 -h /var/hugo hugo && \ + chown -R hugo: /var/hugo && \ + runuser -u hugo -- git config --global --add safe.directory /src + +COPY --from=0 /go/bin/hugo /usr/local/bin/hugo + +WORKDIR /src + +USER hugo:hugo + +EXPOSE 1313 \ No newline at end of file