Seperate base image to speed up build times

This commit is contained in:
Nathan Price 2024-12-10 20:05:29 +00:00
parent 976e508ee5
commit 4aa6923aaf
2 changed files with 49 additions and 0 deletions

View file

@ -6,3 +6,4 @@ config/
.vscode/ .vscode/
Makefile Makefile
README.md README.md
base/

48
base/Dockerfile Normal file
View file

@ -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"