Build static and use nginx instead of the full hugo server (#8)
This pull request will close #4 Hugo server needs about 800mb of memory just to do what nginx can with a way smaller requirements, so it makes sense to stop using `hugo` for serving statics
This commit is contained in:
17
Dockerfile
17
Dockerfile
@ -1,13 +1,16 @@
|
||||
FROM alpine:latest AS builder
|
||||
WORKDIR /src
|
||||
COPY . /src
|
||||
ARG GOHUGO_LINK=https://github.com/gohugoio/hugo/releases/download/v0.110.0/hugo_0.110.0_linux-amd64.tar.gz
|
||||
RUN apk update && apk add curl tar
|
||||
RUN curl -LJO ${GOHUGO_LINK} && tar -xf hugo_0.110.0_linux-amd64.tar.gz
|
||||
RUN chmod +x /src/hugo
|
||||
RUN mv /src/hugo /usr/local/bin/hugo
|
||||
RUN chmod +x /usr/local/bin/hugo
|
||||
RUN hugo
|
||||
|
||||
FROM nginx:stable-alpine
|
||||
COPY --from=builder /src/public /var/www
|
||||
COPY configs/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
EXPOSE 80
|
||||
CMD [ "nginx", "-g", "daemon off;" ]
|
||||
|
||||
FROM alpine:latest
|
||||
WORKDIR /src
|
||||
COPY --from=builder /src/hugo /usr/bin/hugo
|
||||
COPY . /src
|
||||
ENTRYPOINT ["/usr/bin/hugo"]
|
||||
CMD ["--help"]
|
||||
|
Reference in New Issue
Block a user