Create Dockerfile for arm64 architecture.

This commit is contained in:
Mauren Berti
2022-02-18 17:55:57 -05:00
parent 3668b41e34
commit e7b1ef7fda
3 changed files with 46 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
# This is a modified version of the original Dockerfile in this repository,
# edited to install Hugo Extended from a tarball in a way that works with arm64
# architectures.
FROM golang:1.16-alpine
RUN apk add --no-cache \
curl \
gcc \
g++ \
git \
musl-dev \
openssh-client \
rsync \
build-base \
libc6-compat \
npm && \
npm install -D autoprefixer postcss-cli
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 && \
cp /go/bin/hugo /usr/local/bin/hugo && \
mkdir -p /usr/local/src && \
cd /usr/local/src && \
addgroup -Sg 1000 hugo && \
adduser -Sg hugo -u 1000 -h /src hugo
WORKDIR /src
USER hugo:hugo
EXPOSE 1313
+7
View File
@@ -71,6 +71,13 @@ container-image: ## Build a container image for the preview of the website
--tag $(CONTAINER_IMAGE) \
--build-arg HUGO_VERSION=$(HUGO_VERSION)
container-image-arm64: ## Build a container image for the preview of the website that works with arm64
$(CONTAINER_ENGINE) build . \
--file Dockerfile.arm64 \
--network=host \
--tag $(CONTAINER_IMAGE) \
--build-arg HUGO_VERSION=$(HUGO_VERSION)
container-build: module-check
$(CONTAINER_RUN) --read-only --mount type=tmpfs,destination=/tmp,tmpfs-mode=01777 $(CONTAINER_IMAGE) sh -c "npm ci && hugo --minify --environment development"
+2
View File
@@ -45,6 +45,8 @@ make container-serve
If you see errors, it probably means that the hugo container did not have enough computing resources available. To solve it, increase the amount of allowed CPU and memory usage for Docker on your machine ([MacOSX](https://docs.docker.com/docker-for-mac/#resources) and [Windows](https://docs.docker.com/docker-for-windows/#resources)).
If you use a computer with arm64 architecture instead of amd64, use the target `make container-image-arm64` instead to build the container image.
Open up your browser to <http://localhost:1313> to view the website. As you make changes to the source files, Hugo updates the website and forces a browser refresh.
## Running the website locally using Hugo