Yōten: A social tracker for your language learning journey built on the atproto.
at master 56 lines 1.9 kB view raw
1ARG GO_VERSION=1 2FROM golang:${GO_VERSION}-bookworm as builder 3 4# Install the templ CLI tool for Go 5RUN go install github.com/a-h/templ/cmd/templ@latest 6 7# Install the standalone Tailwind CSS CLI 8RUN curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 && \ 9 chmod +x tailwindcss-linux-x64 && \ 10 mv tailwindcss-linux-x64 /usr/local/bin/tailwindcss 11 12# Install the minify CLI tool 13RUN curl -L -o minify.tar.gz https://github.com/tdewolff/minify/releases/download/v2.24.0/minify_linux_amd64.tar.gz && \ 14 tar -xzf minify.tar.gz && \ 15 mv minify /usr/local/bin/minify && \ 16 rm minify.tar.gz 17 18WORKDIR /usr/src/app 19 20COPY go.mod go.sum ./ 21RUN go mod download && go mod verify 22 23COPY . . 24 25RUN /go/bin/templ generate 26 27# Create the directory structure for static assets 28RUN mkdir -p ./static/files 29 30# Minify existing JS files (if any exist) 31RUN minify ./static/*.js -o ./static/files/ 2>/dev/null || true 32 33# Download frontend libraries into the static folder 34RUN curl -sLo ./static/files/htmx.min.js https://cdn.jsdelivr.net/npm/htmx.org@2.0.6/dist/htmx.min.js 35RUN curl -sLo ./static/files/lucide.min.js https://unpkg.com/lucide@0.525.0/dist/umd/lucide.min.js 36RUN curl -sLo ./static/files/alpinejs.min.js https://cdn.jsdelivr.net/npm/alpinejs@3.14.9/dist/cdn.min.js 37 38RUN tailwindcss -i ./input.css -o ./static/files/style.css --minify 39 40RUN go build -v -o /run-app ./cmd/server/main.go 41 42FROM debian:bookworm 43 44# Install ca-certificates for TLS and the sqlite3 CLI tool 45RUN apt-get update -y && \ 46 apt-get install -y ca-certificates fuse3 sqlite3 && \ 47 rm -rf /var/lib/apt/lists/* 48 49# Copy LiteFS binary and config 50COPY --from=flyio/litefs:0.5 /usr/local/bin/litefs /usr/local/bin/litefs 51COPY litefs.yml /etc/litefs.yml 52 53# Copy the compiled Go binary 54COPY --from=builder /run-app /usr/local/bin/ 55 56CMD ["litefs", "mount", "-config", "/etc/litefs.yml"]