Fix Docker build and GitHub Actions workflow issues with npm install

This commit is contained in:
stabgan
2025-03-26 23:13:43 +05:30
parent 4f1b258a01
commit d02e0a9299
2 changed files with 22 additions and 9 deletions

View File

@@ -16,27 +16,27 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry - name: Log in to GitHub Container Registry
uses: docker/login-action@v2 uses: docker/login-action@v3
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Docker Hub - name: Log in to Docker Hub
uses: docker/login-action@v2 uses: docker/login-action@v3
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata for Docker - name: Extract metadata for Docker
id: meta id: meta
uses: docker/metadata-action@v4 uses: docker/metadata-action@v5
with: with:
images: | images: |
ghcr.io/stabgan/openrouter-mcp-multimodal ghcr.io/stabgan/openrouter-mcp-multimodal
@@ -48,7 +48,7 @@ jobs:
type=raw,value=latest,enable={{is_default_branch}} type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image - name: Build and push Docker image
uses: docker/build-push-action@v4 uses: docker/build-push-action@v5
with: with:
context: . context: .
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
@@ -56,6 +56,10 @@ jobs:
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
# Set build arguments for npm
build-args: |
NPM_CONFIG_STRICT_SSL=false
NPM_CONFIG_REGISTRY=https://registry.npmjs.org/
publish-npm: publish-npm:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -64,14 +68,19 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v3 uses: actions/setup-node@v4
with: with:
node-version: '18.x' node-version: '18.x'
registry-url: 'https://registry.npmjs.org/' registry-url: 'https://registry.npmjs.org/'
- name: Configure npm
run: |
npm config set strict-ssl false
npm config set registry https://registry.npmjs.org/
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci

View File

@@ -8,9 +8,13 @@ RUN apk add --no-cache \
make \ make \
python3 python3
# Configure npm to handle potential certificate issues
RUN npm config set strict-ssl false
RUN npm config set registry https://registry.npmjs.org/
# Copy package files and install dependencies # Copy package files and install dependencies
COPY package*.json ./ COPY package*.json ./
RUN npm install RUN npm ci
# Copy source code # Copy source code
COPY . . COPY . .