2023-07-19 22:27:48 +02:00
|
|
|
# syntax=docker/dockerfile-upstream:master-labs
|
2022-08-08 16:47:39 +02:00
|
|
|
# refs:
|
|
|
|
# https://docs.docker.com/develop/develop-images/build_enhancements/#overriding-default-frontends
|
|
|
|
# https://pythonspeed.com/articles/docker-buildkit/
|
2022-08-31 21:46:29 +02:00
|
|
|
FROM docker.io/alpine/git:v2.36.2 AS submodules
|
2020-10-03 21:00:19 +02:00
|
|
|
|
|
|
|
WORKDIR /homepage
|
|
|
|
|
2022-08-08 15:20:50 +02:00
|
|
|
COPY . .
|
|
|
|
|
2022-08-31 21:46:29 +02:00
|
|
|
RUN git submodule init && \
|
|
|
|
git submodule update --recursive
|
|
|
|
|
2022-10-28 23:32:35 +02:00
|
|
|
FROM docker.io/immawanderer/alpine-hugo:hugo-v0.105.0 AS hugobuild
|
2022-08-31 21:46:29 +02:00
|
|
|
|
|
|
|
COPY --from=submodules /homepage/ /homepage/
|
|
|
|
|
|
|
|
WORKDIR /homepage
|
|
|
|
|
|
|
|
RUN hugo version && \
|
|
|
|
hugo --minify --gc=true --cleanDestinationDir
|
2022-08-08 15:20:50 +02:00
|
|
|
|
2022-12-16 17:19:35 +01:00
|
|
|
FROM docker.io/library/golang:1.18.9-alpine3.17 AS gobuild
|
2022-08-08 15:20:50 +02:00
|
|
|
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"]
|