# # Stage 1: build the embed bundle with pnpm. # # Uses the official pnpm image. Node is auto-downloaded by pnpm using the # `devEngines.runtime` field in package.json (onFail: "download"). # FROM ghcr.io/pnpm/pnpm:11 AS web-build WORKDIR /app ENV DEBIAN_FRONTEND=noninteractive # # pnpm config # ENV CI=1 # use the pnpm version specified in package.json ENV pnpm_config_pm_on_fail=download COPY . . # # Generate the embed bundle. NOTE: this will change # RUN --mount=type=cache,id=pnpm,target=/pnpm/store \ pnpm install --frozen-lockfile && \ export PATH="/app/node_modules/.bin:$PATH" && \ cd bskyembed && pnpm install --frozen-lockfile && cd .. && \ pnpm build-embed # DEBUG RUN find ./bskyweb/embedr-static && find ./bskyweb/embedr-templates && find ./bskyembed/dist # hack around issue with empty directory and go:embed RUN touch bskyweb/static/js/empty.txt RUN touch bskyweb/static/css/empty.txt RUN touch bskyweb/static/media/empty.txt # # Stage 2: build the embedr Go binary, embedding the assets from stage 1. # FROM golang:1.26-bookworm AS go-build WORKDIR /usr/src/social-app ENV GODEBUG="netdns=go" ENV GOOS="linux" ARG TARGETARCH ENV GOARCH=${TARGETARCH:-amd64} ENV CGO_ENABLED=1 ENV GOEXPERIMENT="loopvar" COPY --from=web-build /app/bskyweb ./bskyweb RUN cd bskyweb/ && \ go mod download && \ go mod verify RUN cd bskyweb/ && \ go build \ -v \ -trimpath \ -tags timetzdata \ -o /embedr \ ./cmd/embedr # # Stage 3: runtime image. # FROM debian:bookworm-slim ENV GODEBUG=netdns=go ENV TZ=Etc/UTC ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install --yes \ dumb-init \ ca-certificates ENTRYPOINT ["dumb-init", "--"] WORKDIR /embedr COPY --from=go-build /embedr /usr/bin/embedr CMD ["/usr/bin/embedr"] LABEL org.opencontainers.image.source=https://github.com/bluesky-social/social-app LABEL org.opencontainers.image.description="embed.bsky.app Web App" LABEL org.opencontainers.image.licenses=MIT