Write on the margins of the internet. Powered by the AT Protocol. margin.at
extension web atproto comments
at main 48 lines 967 B view raw
1FROM oven/bun:1 AS frontend-builder 2 3WORKDIR /app/web 4COPY web/package.json web/bun.lock ./ 5RUN bun install 6COPY web/ ./ 7RUN bun run build 8 9FROM golang:1.24-alpine AS backend-builder 10 11RUN apk add --no-cache gcc musl-dev 12 13WORKDIR /app 14COPY backend/go.mod backend/go.sum ./ 15RUN go mod download 16 17COPY backend/ ./ 18RUN CGO_ENABLED=1 GOOS=linux go build -a -ldflags '-linkmode external -extldflags "-static"' -o margin-server ./cmd/server 19 20FROM node:20-alpine 21 22RUN apk add --no-cache ca-certificates tzdata 23 24WORKDIR /app 25 26COPY --from=backend-builder /app/margin-server ./margin-server 27 28COPY --from=frontend-builder /app/web/dist ./dist 29 30RUN npm install @resvg/resvg-js@2.6.2 --no-save 31 32ENV PORT=8080 33ENV API_PORT=8081 34ENV DATABASE_URL=margin.db 35ENV HOST=0.0.0.0 36ENV API_URL=http://localhost:8081 37 38EXPOSE 8080 39 40COPY <<'EOF' /app/start.sh 41#!/bin/sh 42PORT=$API_PORT ./margin-server & 43node ./dist/server/entry.mjs & 44wait -n 45EOF 46RUN chmod +x /app/start.sh 47 48CMD ["/app/start.sh"]