about summary refs log tree commit diff
path: root/Dockerfile.bskylink
diff options
context:
space:
mode:
authordevin ivy <devinivy@gmail.com>2024-06-21 12:41:06 -0400
committerGitHub <noreply@github.com>2024-06-21 12:41:06 -0400
commit55812b03940852f1f91cd0a46b5c093601c854a9 (patch)
tree54956cb522786b1260b0a556f6f7c3ea1b0aed11 /Dockerfile.bskylink
parentba21fddd7897513fef663b826094878ad0ff1556 (diff)
downloadvoidsky-55812b03940852f1f91cd0a46b5c093601c854a9.tar.zst
Bsky short link service (#4542)
* bskylink: scaffold service w/ initial config and schema

* bskylink: implement link creation and redirects

* bskylink: tidy

* bskylink: tests

* bskylink: tidy, add error handler

* bskylink: add dockerfile

* bskylink: add build

* bskylink: fix some express plumbing

* bskyweb: proxy fallthrough routes to link service redirects

* bskyweb: build w/ link proxy

* Add AASA to bskylink (#4588)

---------

Co-authored-by: Hailey <me@haileyok.com>
Diffstat (limited to 'Dockerfile.bskylink')
-rw-r--r--Dockerfile.bskylink41
1 files changed, 41 insertions, 0 deletions
diff --git a/Dockerfile.bskylink b/Dockerfile.bskylink
new file mode 100644
index 000000000..acde23225
--- /dev/null
+++ b/Dockerfile.bskylink
@@ -0,0 +1,41 @@
+FROM node:20.11-alpine3.18 as build
+
+# Move files into the image and install
+WORKDIR /app
+
+COPY ./bskylink/package.json ./
+COPY ./bskylink/yarn.lock ./
+RUN yarn install --frozen-lockfile
+
+COPY ./bskylink ./
+
+# build then prune dev deps
+RUN yarn build
+RUN yarn install --production --ignore-scripts --prefer-offline
+
+# Uses assets from build stage to reduce build size
+FROM node:20.11-alpine3.18
+
+RUN apk add --update dumb-init
+
+# Avoid zombie processes, handle signal forwarding
+ENTRYPOINT ["dumb-init", "--"]
+
+WORKDIR /app
+COPY --from=build /app /app
+RUN mkdir /app/data && chown node /app/data
+
+VOLUME /app/data
+EXPOSE 3000
+ENV LINK_PORT=3000
+ENV NODE_ENV=production
+# potential perf issues w/ io_uring on this version of node
+ENV UV_USE_IO_URING=0
+
+# https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md#non-root-user
+USER node
+CMD ["node", "--heapsnapshot-signal=SIGUSR2", "--enable-source-maps", "dist/bin.js"]
+
+LABEL org.opencontainers.image.source=https://github.com/bluesky-social/social-app
+LABEL org.opencontainers.image.description="Bsky Link Service"
+LABEL org.opencontainers.image.licenses=UNLICENSED