17 行
926 B
Docker
17 行
926 B
Docker
FROM alpine:3.23 AS build
|
|
RUN apk add --no-cache hugo tzdata rsvg-convert font-noto-cjk go
|
|
WORKDIR /src
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 go build -trimpath -o /rate ./cmd/rate && chmod 755 docker-entrypoint.d/40-rate.sh
|
|
RUN hugo --minify --destination /public \
|
|
&& find /public -name ogp.svg | while read -r card; do rsvg-convert --width 1200 --height 630 --output "${card%.svg}.png" "$card" && rm "$card"; done \
|
|
&& test -z "$(find /public -name ogp.svg)" \
|
|
&& test -s /public/ogp.png && test -s /public/pnl/ogp.png
|
|
|
|
FROM nginx/nginx-unprivileged:1.30.7-alpine3.24
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
COPY --from=build /public /usr/share/nginx/html
|
|
COPY --from=build /rate /usr/local/bin/rate
|
|
COPY --from=build /src/docker-entrypoint.d/40-rate.sh /docker-entrypoint.d/40-rate.sh
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 CMD wget -q -O /dev/null http://127.0.0.1:8080/robots.txt || exit 1
|