refactor(ci): use manual git clone instead of actions/checkout to avoid node dependency
Build and Deploy / Build and Push Docker Image (push) Failing after 9s
Build and Deploy / Build and Push Docker Image (push) Failing after 9s
- Install Node.js manually using curl - Use git clone instead of actions/checkout@v4 - Follow license project CI approach
This commit is contained in:
+33
-43
@@ -15,50 +15,9 @@ env:
|
||||
IMAGE_NAME: admin/taskpool
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Frontend
|
||||
runs-on: ubuntu
|
||||
container:
|
||||
image: node:22
|
||||
env:
|
||||
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 9
|
||||
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
working-directory: web
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
|
||||
id: pnpm-cache
|
||||
|
||||
- name: Setup pnpm cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: web
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build
|
||||
working-directory: web
|
||||
run: pnpm build
|
||||
|
||||
docker:
|
||||
name: Build and Push Docker Image
|
||||
runs-on: ubuntu
|
||||
needs: build
|
||||
if: github.event_name == 'push'
|
||||
env:
|
||||
RUNNER_TOOL_CACHE: /toolcache
|
||||
@@ -79,14 +38,45 @@ jobs:
|
||||
fi
|
||||
docker --version
|
||||
|
||||
- name: Install Node.js
|
||||
run: |
|
||||
export PATH="/toolcache/bin:$PATH"
|
||||
if ! command -v node &> /dev/null; then
|
||||
if command -v apk &> /dev/null; then
|
||||
apk add --no-cache nodejs npm
|
||||
else
|
||||
curl -fsSL https://nodejs.org/dist/v22.0.0/node-v22.0.0-linux-x64.tar.xz | tar -xJ -C /tmp
|
||||
cp -r /tmp/node-v22.0.0-linux-x64/{bin,lib,share} /toolcache/
|
||||
fi
|
||||
fi
|
||||
node --version
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
run: |
|
||||
cd /tmp
|
||||
git clone --depth=1 https://admin:${{ secrets.TOKEN }}@git.viaeon.com/admin/TaskPool.git repo
|
||||
cd repo
|
||||
|
||||
- name: Setup pnpm
|
||||
run: |
|
||||
export PATH="/toolcache/bin:$PATH"
|
||||
npm install -g pnpm@9
|
||||
pnpm --version
|
||||
|
||||
- name: Install dependencies and build
|
||||
run: |
|
||||
export PATH="/toolcache/bin:$PATH"
|
||||
cd /tmp/repo/web
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm build
|
||||
|
||||
- name: Login to Registry
|
||||
run: echo "${{ secrets.TOKEN }}" | docker login ${{ env.REGISTRY }} -u admin --password-stdin
|
||||
run: |
|
||||
echo "${{ secrets.TOKEN }}" | docker login ${{ env.REGISTRY }} -u admin --password-stdin
|
||||
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
cd /tmp/repo
|
||||
docker build -f Dockerfile.standalone -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} .
|
||||
|
||||
- name: Push Docker image
|
||||
|
||||
Reference in New Issue
Block a user