Fix: Optimize npm installation process for more reliable builds
This commit is contained in:
6
.github/workflows/docker-publish.yml
vendored
6
.github/workflows/docker-publish.yml
vendored
@@ -60,6 +60,8 @@ jobs:
|
|||||||
build-args: |
|
build-args: |
|
||||||
NPM_CONFIG_STRICT_SSL=false
|
NPM_CONFIG_STRICT_SSL=false
|
||||||
NPM_CONFIG_REGISTRY=https://registry.npmjs.org/
|
NPM_CONFIG_REGISTRY=https://registry.npmjs.org/
|
||||||
|
NPM_CONFIG_FETCH_RETRY_MINTIMEOUT=20000
|
||||||
|
NPM_CONFIG_FETCH_RETRY_MAXTIMEOUT=120000
|
||||||
NODE_ENV=development
|
NODE_ENV=development
|
||||||
|
|
||||||
publish-npm:
|
publish-npm:
|
||||||
@@ -81,9 +83,11 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
npm config set strict-ssl false
|
npm config set strict-ssl false
|
||||||
npm config set registry https://registry.npmjs.org/
|
npm config set registry https://registry.npmjs.org/
|
||||||
|
npm config set fetch-retry-mintimeout 20000
|
||||||
|
npm config set fetch-retry-maxtimeout 120000
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm install
|
run: npm cache clean --force && npm install --legacy-peer-deps --no-optional
|
||||||
|
|
||||||
- name: Build package
|
- name: Build package
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|||||||
16
Dockerfile
16
Dockerfile
@@ -2,22 +2,26 @@ FROM node:18-alpine
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install dependencies for sharp
|
# Install dependencies for sharp and network troubleshooting
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
g++ \
|
g++ \
|
||||||
make \
|
make \
|
||||||
python3
|
python3 \
|
||||||
|
curl \
|
||||||
|
ca-certificates
|
||||||
|
|
||||||
# Configure npm to handle potential certificate issues
|
# Configure npm for better reliability
|
||||||
RUN npm config set strict-ssl false
|
RUN npm config set strict-ssl false
|
||||||
RUN npm config set registry https://registry.npmjs.org/
|
RUN npm config set registry https://registry.npmjs.org/
|
||||||
|
RUN npm config set fetch-retry-mintimeout 20000
|
||||||
|
RUN npm config set fetch-retry-maxtimeout 120000
|
||||||
|
|
||||||
# Copy package files
|
# Copy package files
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
|
|
||||||
# Install dependencies with development environment for building
|
# Clean npm cache and install dependencies
|
||||||
ENV NODE_ENV=development
|
RUN npm cache clean --force && \
|
||||||
RUN npm install --no-optional --verbose
|
npm install --legacy-peer-deps --no-optional
|
||||||
|
|
||||||
# Copy source code
|
# Copy source code
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|||||||
Reference in New Issue
Block a user