From 4aa6923aafa89aa9d4d550fb442ac84fcbd30337 Mon Sep 17 00:00:00 2001 From: Nathan Price Date: Tue, 10 Dec 2024 20:05:29 +0000 Subject: [PATCH] Seperate base image to speed up build times --- .dockerignore | 1 + base/Dockerfile | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 base/Dockerfile diff --git a/.dockerignore b/.dockerignore index fffd364..0581833 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,3 +6,4 @@ config/ .vscode/ Makefile README.md +base/ \ No newline at end of file diff --git a/base/Dockerfile b/base/Dockerfile new file mode 100644 index 0000000..a30a0a1 --- /dev/null +++ b/base/Dockerfile @@ -0,0 +1,48 @@ +################################################################################ +# adapted from https://github.com/bluesky-social/pds/blob/v0.4.74/Dockerfile +################################################################################ +FROM node:20.11-bookworm-slim AS pds-build + +RUN npm install -g pnpm && apt-get update && apt-get -y install unzip + +# Download and extract the PDS archive +WORKDIR /app +ADD https://github.com/bluesky-social/pds/archive/refs/tags/v0.4.74.zip . +RUN unzip v0.4.74.zip && \ + mv pds-0.4.74/service/** . && \ + mv pds-0.4.74/pdsadmin.sh . + +RUN pnpm install --prod=true --frozen-lockfile + +################################################################################ +# adapted from https://github.com/bluesky-social/pds/blob/v0.4.74/Dockerfile +################################################################################ +FROM node:20.11-bookworm-slim + +RUN apt-get update && apt-get install -y \ + dumb-init \ + ca-certificates \ + curl \ + gnupg \ + jq \ + lsb-release \ + openssl \ + sqlite3 \ + bsdextrautils \ + xxd +# bsdextrautils for `column` command in the accounts script + +WORKDIR /app +COPY --from=pds-build /app /app + +EXPOSE 3000 +ENV PDS_PORT=3000 +ENV NODE_ENV=production +# potential perf issues w/ io_uring on this version of node +ENV UV_USE_IO_URING=0 + +RUN userdel node + +LABEL org.opencontainers.image.source="https://github.com/bluesky-social/pds" +LABEL org.opencontainers.image.description="AT Protocol PDS" +LABEL org.opencontainers.image.licenses="MIT"