refactor: update Dockerfile to set NPM registry as a build argument and create entrypoint script

This commit is contained in:
samanhappy
2025-04-05 16:48:56 +08:00
parent 96aa06b999
commit 4b13c007f2

View File

@@ -2,7 +2,8 @@ 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
ARG NPM_REGISTRY=https://registry.npmjs.org
ENV NPM_REGISTRY=${NPM_REGISTRY}
WORKDIR /app
@@ -15,4 +16,11 @@ RUN pnpm build
EXPOSE 3000
# Create entrypoint script
RUN echo '#!/bin/sh\n\
npm config set registry ${NPM_REGISTRY}\n\
exec "$@"' > /entrypoint.sh && \
chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["pnpm", "start"]