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
11RUN npx esbuild node_modules/prosemirror-collab/dist/index.js --bundle --format=esm --minify --outfile=collab.min.js
12
13FROM golang:1.23-alpine AS builder
14
15RUN apk add --no-cache gcc musl-dev
16
17WORKDIR /app
18COPY go.mod go.sum ./
19RUN go mod download
20
21COPY . .
22RUN CGO_ENABLED=1 go build -o markdownhub ./cmd/server
23
24FROM alpine:3.20
25
26RUN apk add --no-cache ca-certificates
27
28WORKDIR /app
29COPY --from=builder /app/markdownhub .
30COPY --from=builder /app/templates ./templates
31COPY --from=builder /app/static ./static
32COPY --from=jsbuilder /build/editor.min.js ./static/vendor/editor.js
33COPY --from=jsbuilder /build/milkdown.min.js ./static/vendor/milkdown.js
34COPY --from=jsbuilder /build/collab.min.js ./static/vendor/collab.js
35COPY --from=builder /app/migrations ./migrations
36
37EXPOSE 8080
38ENV PORT=8080
39
40CMD ["./markdownhub"]