Diffdown is a real-time collaborative Markdown editor/previewer built on the AT Protocol
diffdown.com
1FROM node:alpine AS jsbuilder
2
3WORKDIR /build
4COPY static/vendor/editor.js ./editor.js
5RUN npx --yes esbuild editor.js --bundle=false --minify --outfile=editor.min.js
6
7COPY package.json ./package.json
8RUN npm install --silent
9COPY milkdown-entry.js ./milkdown-entry.js
10RUN npx esbuild milkdown-entry.js --bundle --format=esm --minify --outfile=milkdown.min.js
11
12FROM golang:1.23-alpine AS builder
13
14RUN apk add --no-cache gcc musl-dev
15
16WORKDIR /app
17COPY go.mod go.sum ./
18RUN go mod download
19
20COPY . .
21RUN CGO_ENABLED=1 go build -o markdownhub ./cmd/server
22
23FROM alpine:3.20
24
25RUN apk add --no-cache ca-certificates
26
27WORKDIR /app
28COPY --from=builder /app/markdownhub .
29COPY --from=builder /app/templates ./templates
30COPY --from=builder /app/static ./static
31COPY --from=jsbuilder /build/editor.min.js ./static/vendor/editor.js
32COPY --from=jsbuilder /build/milkdown.min.js ./static/vendor/milkdown.js
33COPY --from=builder /app/migrations ./migrations
34
35EXPOSE 8080
36ENV PORT=8080
37
38CMD ["./markdownhub"]