wanderer
cfe496dcb7
Some checks failed
continuous-integration/drone/push Build is failing
the entire './public' folder that Hugo produces is embedded into a variable of 'embed.FS' type and served directly using the default http mux that Go std offers. ci, pre-commit, Dockerfile and compose file have all been updated accordingly. nginx is no longer needed to front the site files, which enabled switching to a SCRATCH image containing just a single statically linked "homepage" app that has all files (html, css, js) embedded. the containers are otherwise empty (as the name SCRATCH suggests), which further decreases potential attack surface area. Co-authored-by: surtur <a_mirre@utb.cz> Reviewed-on: #33
26 lines
609 B
Docker
26 lines
609 B
Docker
FROM docker.io/immawanderer/fedora-hugo:linux-amd64 AS hugobuild
|
|
|
|
WORKDIR /homepage
|
|
|
|
COPY . .
|
|
|
|
RUN git submodule init \
|
|
&& git submodule update --recursive \
|
|
&& hugo version \
|
|
&& hugo --minify --gc=true --cleanDestinationDir
|
|
|
|
FROM docker.io/library/golang:1.18.5-alpine3.16 AS gobuild
|
|
COPY --from=hugobuild /homepage/ /homepage/
|
|
|
|
WORKDIR /homepage
|
|
|
|
ARG VCS_REF=development
|
|
|
|
RUN CGO_ENABLED=0 GOFLAGS='-trimpath -mod=readonly -modcacherw' \
|
|
go build -o homepage-app -v -ldflags "-s -w -X main.version=$VCS_REF" .
|
|
|
|
FROM scratch
|
|
COPY --from=gobuild /homepage/homepage-app /homepage
|
|
|
|
ENTRYPOINT ["/homepage"]
|