aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2025-04-21 08:05:48 -0400
committerXe Iaso <me@xeiaso.net>2025-04-21 08:05:48 -0400
commit049cfaba3b11b059f95a1453fb470536adc65e9c (patch)
tree64533c5cadfac87196f8a08c7799e7be10d08694
parentd913956e760d076ff7f72622871f3fd59d8a3a8e (diff)
downloadxesite-049cfaba3b11b059f95a1453fb470536adc65e9c.tar.xz
xesite-049cfaba3b11b059f95a1453fb470536adc65e9c.zip
docker: make xesite use Ubuntu in prod
Signed-off-by: Xe Iaso <me@xeiaso.net>
-rw-r--r--.github/workflows/earthly.yml3
-rw-r--r--Earthfile2
-rw-r--r--docker-bake.hcl22
-rw-r--r--docker/xesite.Dockerfile48
4 files changed, 58 insertions, 17 deletions
diff --git a/.github/workflows/earthly.yml b/.github/workflows/earthly.yml
index fe45048..f33f0ed 100644
--- a/.github/workflows/earthly.yml
+++ b/.github/workflows/earthly.yml
@@ -71,7 +71,8 @@ jobs:
- 'pb/**/*'
- 'go.mod'
- 'go.sum'
- - 'Earthfile'
+ - 'docker/*'
+ - "docker-bake.hcl"
- 'manifest/**/*.yaml'
- uses: azure/setup-kubectl@v4
if: steps.changes.outputs.src == 'true'
diff --git a/Earthfile b/Earthfile
index 68cc0fd..3d40153 100644
--- a/Earthfile
+++ b/Earthfile
@@ -3,7 +3,7 @@ FROM alpine:edge
WORKDIR /app
deps:
- FROM golang:1.23-alpine
+ FROM golang:1.24-alpine
WORKDIR /app
COPY go.mod go.sum ./
diff --git a/docker-bake.hcl b/docker-bake.hcl
index a4e6d7e..e92eb55 100644
--- a/docker-bake.hcl
+++ b/docker-bake.hcl
@@ -1,10 +1,9 @@
-variable "ALPINE_VERSION" {
- default = "edge"
-}
-
-variable "GO_VERSION" {
- default = "1.24"
-}
+variable "ALPINE_VERSION" { default = "edge" }
+variable "DENO_VERSION" { default = "2.2.11" }
+variable "DHALL_VERSION" { default = "1.42.2" }
+variable "DHALL_JSON_VERSION" { default = "1.7.12" }
+variable "GO_VERSION" { default = "1.24" }
+variable "UBUNTU_VERSION" { default = "24.04" }
group "default" {
targets = [ "patreon-saasproxy", "xesite" ]
@@ -27,11 +26,18 @@ target "patreon-saasproxy" {
target "xesite" {
args = {
ALPINE_VERSION = null
+ DENO_VERSION = null
+ DHALL_VERSION = null
+ DHALL_JSON_VERSION = null
GO_VERSION = null
+ UBUNTU_VERSION = "24.04"
}
context = "."
dockerfile = "./docker/xesite.Dockerfile"
- platforms = [ "linux/amd64", "linux/arm64" ]
+ platforms = [
+ "linux/amd64"
+ #"linux/arm64",
+ ]
pull = true
tags = [
"registry.int.xeserv.us/xe/site/bin:main"
diff --git a/docker/xesite.Dockerfile b/docker/xesite.Dockerfile
index 8236751..41dbe7c 100644
--- a/docker/xesite.Dockerfile
+++ b/docker/xesite.Dockerfile
@@ -1,6 +1,8 @@
-ARG GO_VERSION=1.24
ARG ALPINE_VERSION=edge
-FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION}-alpine AS build
+ARG GO_VERSION=1.24
+ARG UBUNTU_VERSION=24.04
+
+FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS build
ARG TARGETOS
ARG TARGETARCH
@@ -13,31 +15,63 @@ RUN go mod download
COPY . .
RUN --mount=type=cache,target=/root/.cache GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 go build -gcflags "all=-N -l" -o /app/bin/xesite ./cmd/xesite
-FROM --platform=${BUILDPLATFORM} alpine:${ALPINE_VERSION} AS fonts
+#
+# Images for various facets of xesite
+#
+# Iosevka for the resume
+FROM --platform=${BUILDPLATFORM} alpine:${ALPINE_VERSION} AS fonts
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
+# dhall-json for configuration building
FROM --platform=${BUILDPLATFORM} alpine:${ALPINE_VERSION} AS dhall-json
-
+ARG DHALL_VERSION=1.42.2
+ARG DHALL_JSON_VERSION=1.7.12
RUN mkdir -p /app
WORKDIR /app
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 \
+ && curl -L -o dhall-linux.tar.bz2 https://github.com/dhall-lang/dhall-haskell/releases/download/${DHALL_VERSION}/dhall-json-${DHALL_JSON_VERSION}-x86_64-linux.tar.bz2 \
&& tar -xvjf dhall-linux.tar.bz2 \
&& mv bin/dhall-to-json .
-FROM alpine:${ALPINE_VERSION} AS run
+# deno
+FROM alpine:${ALPINE_VERSION} AS deno
+ARG DENO_VERSION=2.2.11
+RUN mkdir -p /app
WORKDIR /app
+RUN apk add -U curl unzip ca-certificates \
+ && curl -sSLo deno.zip https://github.com/denoland/deno/releases/download/v${DENO_VERSION}/deno-$(uname -m)-unknown-linux-gnu.zip \
+ && unzip deno.zip
+
+# typst
+FROM alpine:${ALPINE_VERSION} AS typst
+ARG TYPST_VERSION=0.13.1
+RUN mkdir -p /app
+WORKDIR /app
+RUN set -x \
+ && apk add -U curl xz ca-certificates \
+ && curl -sSLo typst.tar.xz https://github.com/typst/typst/releases/download/v${TYPST_VERSION}/typst-$(uname -m)-unknown-linux-musl.tar.xz \
+ && tar xJf typst.tar.xz -C . \
+ && mv typst-$(uname -m)-unknown-linux-musl/typst .
+
+# runtime image
+FROM ubuntu:${UBUNTU_VERSION} AS run
+WORKDIR /app
+
+RUN apt-get update \
+ && apt-get -y install ca-certificates media-types
-RUN apk add -U ca-certificates deno typst mailcap
+#RUN apk add -U ca-certificates deno typst mailcap
ENV TYPST_FONT_PATHS=/app/fonts
COPY --from=build /app/bin/xesite /app/bin/xesite
COPY --from=fonts /fonts /app/fonts
COPY --from=dhall-json /app/dhall-to-json /usr/local/bin/dhall-to-json
+COPY --from=deno /app/deno /usr/local/bin/deno
+COPY --from=typst /app/typst /usr/local/bin/typst
CMD ["/app/bin/xesite"]