From 16d3f2da34e0f1cbd2f0153463bdd7490c9faef1 Mon Sep 17 00:00:00 2001 From: samanhappy Date: Sat, 5 Apr 2025 17:01:01 +0800 Subject: [PATCH] feat: add entrypoint script to configure npm registry and streamline container startup --- Dockerfile | 5 ++++- entrypoint.sh | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index b1af91b..e02bc3e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,9 @@ FROM python:3.12-slim-bookworm COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ FROM node:22-alpine -RUN npm config set registry https://registry.npmmirror.com + +COPY entrypoint.sh /usr/local/bin/entrypoint.sh +RUN chmod +x /usr/local/bin/entrypoint.sh WORKDIR /app @@ -15,4 +17,5 @@ RUN pnpm build EXPOSE 3000 +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] CMD ["pnpm", "start"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..8aa2921 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/sh +NPM_REGISTRY=${NPM_REGISTRY:-https://registry.npmjs.org/} +echo "Setting npm registry to ${NPM_REGISTRY}" +npm config set registry "$NPM_REGISTRY" + +exec "$@"