2020-09-14 19:43:52 +00:00
|
|
|
FROM golang:1.14-alpine as go-builder
|
|
|
|
|
|
|
|
ENV GO111MODULE=on
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
ADD social-image-gen .
|
|
|
|
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-w -s" -o social-image-gen main.go
|
|
|
|
|
2020-09-13 18:36:10 +00:00
|
|
|
FROM debian:buster AS builder
|
|
|
|
|
|
|
|
RUN apt-get -qq update \
|
|
|
|
&& DEBIAN_FRONTEND=noninteractive apt-get -qq install -y --no-install-recommends libstdc++6 python-pygments git ca-certificates asciidoc curl \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
ENV HUGO_VERSION 0.74.3
|
|
|
|
ENV HUGO_BINARY hugo_extended_${HUGO_VERSION}_Linux-64bit.deb
|
|
|
|
RUN curl -sL -o /tmp/hugo.deb \
|
|
|
|
https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/${HUGO_BINARY} && \
|
|
|
|
dpkg -i /tmp/hugo.deb && \
|
2020-09-13 18:53:40 +00:00
|
|
|
rm /tmp/hugo.deb
|
2020-09-13 18:36:10 +00:00
|
|
|
|
2020-09-14 19:43:52 +00:00
|
|
|
COPY --from=go-builder /app/social-image-gen /social-image-gen
|
|
|
|
|
2020-09-13 18:36:10 +00:00
|
|
|
WORKDIR /app
|
|
|
|
ADD . .
|
2020-09-14 19:43:52 +00:00
|
|
|
|
|
|
|
ADD ./social-image-gen/fonts/ /fonts
|
|
|
|
RUN /social-image-gen --mode posts
|
2020-09-13 18:36:10 +00:00
|
|
|
RUN hugo -d /usr/share/nginx/html/
|
|
|
|
|
|
|
|
FROM nginx:latest
|
|
|
|
COPY --from=builder /usr/share/nginx/html/ /usr/share/nginx/html/
|