blog/Dockerfile
2022-12-29 11:50:38 +01:00

24 lines
No EOL
743 B
Docker

FROM docker.io/alpine:latest as builder
WORKDIR /tmp
RUN apk add -U --no-cache hugo curl tar jq && \
export CADDY_VERSION=$(curl https://api.github.com/repos/caddyserver/caddy/releases/latest | jq -r '.tag_name | (sub("v";""))') && \
curl -L https://github.com/caddyserver/caddy/releases/download/v${CADDY_VERSION}/caddy_${CADDY_VERSION}_linux_amd64.tar.gz | tar -xvz caddy
WORKDIR /src
COPY . /src/
RUN hugo --minify --environment production --config config.toml
FROM gcr.io/distroless/static as final
COPY --from=builder /tmp/caddy /bin
COPY --from=builder /src/public /usr/share/caddy
COPY deploy/caddy/caddy.json /etc/caddy/caddy.json
EXPOSE 3000
ENTRYPOINT [ "/bin/caddy" ]
CMD [ "run", "--config=/etc/caddy/caddy.json" ]