ci(workflow): simplify Node.js installation and optimize Docker steps

Replace multi-step Node.js and npm install with single Alpine package install,
and simplify Docker builder setup by switching from GitHub Action to direct
CLI installation via apk. Also enable network debugging tools for better
troubleshooting in the CI environment.
This commit is contained in:
nocci 2026-03-07 12:45:30 +00:00
parent 09d854ffb1
commit ddb37b5c82

View file

@ -46,18 +46,9 @@ jobs:
- name: Install Node.js and Sonar Scanner - name: Install Node.js and Sonar Scanner
run: | run: |
apk add --no-cache nodejs npm curl
npm install -g sonarqube-scanner npm install -g sonarqube-scanner
- name: Install Node.js
run: |
apt-get update
apt-get install -y curl
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs
- name: Install Sonar Scanner (npm)
run: npm install -g sonarqube-scanner
- name: SonarQube Scan - name: SonarQube Scan
env: env:
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
@ -100,9 +91,12 @@ jobs:
docker: docker:
needs: [lint, sonar] needs: [lint, sonar]
runs-on: self-hosted runs-on: self-hosted
container:
image: node:20-alpine
steps: steps:
- name: Network Debugging - name: Network Debugging
run: | run: |
apk add --no-cache iputils bind-tools
cat /etc/resolv.conf cat /etc/resolv.conf
cat /etc/hosts cat /etc/hosts
ping -c 4 server ping -c 4 server
@ -116,7 +110,8 @@ jobs:
git checkout FETCH_HEAD git checkout FETCH_HEAD
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 run: |
apk add --no-cache docker-cli docker-cli-compose
- name: Login to registry - name: Login to registry
run: echo "${{ secrets.REG_TOKEN }}" | docker login "${{ secrets.REGISTRY }}" -u "${{ secrets.REG_USER }}" --password-stdin run: echo "${{ secrets.REG_TOKEN }}" | docker login "${{ secrets.REGISTRY }}" -u "${{ secrets.REG_USER }}" --password-stdin