diff options
author | bnewbold <bnewbold@robocracy.org> | 2024-04-13 12:20:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-13 12:20:06 -0700 |
commit | 58842d03a95af014cb44c3495d109e3bb6731fde (patch) | |
tree | 08c27ccc28e05235e02440d9584788c78d654bc7 /Dockerfile.embedr | |
parent | 196dd3a8abdc4ebdd0a73c5f6afe2acca38d8efc (diff) | |
download | voidsky-58842d03a95af014cb44c3495d109e3bb6731fde.tar.zst |
rebased embedr (#3511)
* skeleton of embedr service, based on bskyweb * embedr container setup * builds on this branch * actual routes * fix embedr go:embed * tweak embedr dockerfile * progress on embedr * fix path params * tweaks to build process * try to get embedr dockerfile to install embed deps * build this branch * updates to match sam's output HTML * try to unbreak embedr dockerfile * small embedr tweak * docker hack * get embed.js copied over to embedr * don't x-frame-options for embed.bsky.app * bskyembed: remove a console.log * use html/template for golang snippet generation * simplify embedr API fetches * missing file * Rm console.log fully --------- Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
Diffstat (limited to 'Dockerfile.embedr')
-rw-r--r-- | Dockerfile.embedr | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/Dockerfile.embedr b/Dockerfile.embedr new file mode 100644 index 000000000..c70251658 --- /dev/null +++ b/Dockerfile.embedr @@ -0,0 +1,78 @@ +FROM golang:1.21-bullseye AS build-env + +WORKDIR /usr/src/social-app + +ENV DEBIAN_FRONTEND=noninteractive + +# Node +ENV NODE_VERSION=18 +ENV NVM_DIR=/usr/share/nvm + +# Go +ENV GODEBUG="netdns=go" +ENV GOOS="linux" +ENV GOARCH="amd64" +ENV CGO_ENABLED=1 +ENV GOEXPERIMENT="loopvar" + +COPY . . + +# +# Generate the JavaScript webpack. NOTE: this will change +# +RUN mkdir --parents $NVM_DIR && \ + wget \ + --output-document=/tmp/nvm-install.sh \ + https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh && \ + bash /tmp/nvm-install.sh + +RUN \. "$NVM_DIR/nvm.sh" && \ + nvm install $NODE_VERSION && \ + nvm use $NODE_VERSION && \ + npm install --global yarn && \ + yarn && \ + cd bskyembed && yarn install --frozen-lockfile && cd .. && \ + yarn intl:build && \ + yarn 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 + +# +# Generate the embedr Go binary. +# +RUN cd bskyweb/ && \ + go mod download && \ + go mod verify + +RUN cd bskyweb/ && \ + go build \ + -v \ + -trimpath \ + -tags timetzdata \ + -o /embedr \ + ./cmd/embedr + +FROM debian:bullseye-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=build-env /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 |