blog/Dockerfile

24 lines
743 B
Text
Raw Normal View History

2022-09-08 20:55:59 +00:00
FROM docker.io/alpine:latest as builder
2022-12-29 10:46:05 +00:00
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
2022-09-08 20:55:59 +00:00
WORKDIR /src
2022-12-23 14:10:41 +00:00
COPY . /src/
2022-09-08 20:55:59 +00:00
2022-12-29 10:46:05 +00:00
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
2022-09-08 20:55:59 +00:00
2022-12-29 10:46:05 +00:00
EXPOSE 3000
2022-09-08 20:55:59 +00:00
2022-12-29 10:46:05 +00:00
ENTRYPOINT [ "/bin/caddy" ]
CMD [ "run", "--config=/etc/caddy/caddy.json" ]