homepage/Dockerfile
surtur 9ae12826a8
All checks were successful
continuous-integration/drone/push Build is passing
dockerfile: migrate to docker frontend v1.3
2022-08-08 16:47:39 +02:00

30 lines
802 B
Docker

# syntax=docker/dockerfile:1.3
# refs:
# https://docs.docker.com/develop/develop-images/build_enhancements/#overriding-default-frontends
# https://pythonspeed.com/articles/docker-buildkit/
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"]