-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |