aboutsummaryrefslogtreecommitdiff
path: root/Earthfile
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2024-06-20 23:42:28 -0400
committerXe Iaso <me@xeiaso.net>2024-06-20 23:42:28 -0400
commit1c243a622be26654027fa4646ab0b27a4ebb00cd (patch)
tree3c08632be087945863d8f373993451aa92c24668 /Earthfile
parent902efdfc306f714bffe2c1a48fbf329cac66489f (diff)
downloadxesite-1c243a622be26654027fa4646ab0b27a4ebb00cd.tar.xz
xesite-1c243a622be26654027fa4646ab0b27a4ebb00cd.zip
attempt to use earthly
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'Earthfile')
-rw-r--r--Earthfile73
1 files changed, 73 insertions, 0 deletions
diff --git a/Earthfile b/Earthfile
new file mode 100644
index 0000000..b477448
--- /dev/null
+++ b/Earthfile
@@ -0,0 +1,73 @@
+VERSION 0.8
+FROM alpine:edge
+WORKDIR /app
+
+deps:
+ FROM golang:1.22-alpine
+ WORKDIR /app
+
+ COPY go.mod go.sum ./
+ RUN go mod download
+
+ SAVE ARTIFACT go.mod
+
+fonts:
+ FROM alpine:edge
+ WORKDIR /fonts
+ RUN apk add -U unzip ca-certificates curl \
+ && curl -Lo iosevka.zip https://cdn.xeiaso.net/static/pkg/iosevka/ttf.zip \
+ && unzip -d /fonts iosevka.zip
+
+ SAVE ARTIFACT /fonts/ttf
+
+dhall-json:
+ FROM alpine:edge
+ RUN apk add -U curl bzip2 ca-certificates \
+ && curl -L -o dhall-linux.tar.bz2 https://github.com/dhall-lang/dhall-haskell/releases/download/1.42.0/dhall-json-1.7.12-x86_64-linux.tar.bz2 \
+ && tar -xvjf dhall-linux.tar.bz2 \
+ && mv bin/dhall-to-json .
+
+ SAVE ARTIFACT dhall-to-json
+
+build-patreon-saasproxy:
+ FROM +deps
+ COPY . .
+
+ RUN --mount=type=cache,target=/root/.cache CGO_ENABLED=0 go build -gcflags "all=-N -l" -o patreon-saasproxy ./cmd/patreon-saasproxy
+
+ SAVE ARTIFACT patreon-saasproxy
+
+patreon-saasproxy:
+ FROM alpine:edge
+ WORKDIR /app
+
+ COPY +build-patreon-saasproxy/patreon-saasproxy /app/patreon-saasproxy
+
+ RUN apk add -U ca-certificates
+
+ CMD ["./patreon-saasproxy"]
+
+ SAVE IMAGE ghcr.io/xe/site/patreon-saasproxy:earthly
+
+build-xesite:
+ FROM +deps
+ COPY . .
+
+ RUN --mount=type=cache,target=/root/.cache CGO_ENABLED=0 go build -gcflags "all=-N -l" -o xesite ./cmd/xesite
+
+ SAVE ARTIFACT xesite
+
+xesite:
+ FROM alpine:edge
+ WORKDIR /app
+
+ COPY +build-xesite/xesite /app/xesite
+ COPY +fonts/ttf /app/fonts
+ COPY +dhall-json/dhall-to-json /usr/local/bin/dhall-to-json
+
+ RUN apk add -U ca-certificates deno typst
+ ENV TYPST_FONT_PATHS=/app/fonts
+
+ CMD ["./xesite"]
+
+ SAVE IMAGE ghcr.io/xe/site/bin:earthly \ No newline at end of file