From cad72da016e342462b835fb0f673757e3b1f7c44 Mon Sep 17 00:00:00 2001 From: Arunavo Ray Date: Tue, 20 May 2025 16:03:40 +0530 Subject: [PATCH] Update Docker and workflow configurations for bun.lock handling --- .dockerignore | 2 +- .github/workflows/astro-build-test.yml | 15 +++++++++++---- .github/workflows/docker-scan.yml | 4 ++-- Dockerfile | 3 ++- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.dockerignore b/.dockerignore index 891306e..02f48e0 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,7 +5,7 @@ # Node.js node_modules -bun.lock +# We don't exclude bun.lock* as it's needed for the build npm-debug.log yarn-debug.log yarn-error.log diff --git a/.github/workflows/astro-build-test.yml b/.github/workflows/astro-build-test.yml index d7e23f3..a0b4020 100644 --- a/.github/workflows/astro-build-test.yml +++ b/.github/workflows/astro-build-test.yml @@ -16,7 +16,7 @@ jobs: build-and-test: name: Build and Test Astro Project runs-on: ubuntu-latest - + steps: - name: Checkout repository uses: actions/checkout@v4 @@ -25,10 +25,17 @@ jobs: uses: oven-sh/setup-bun@v1 with: bun-version: '1.2.9' - cache: true - - name: Install dependencies - run: bun install + - name: Check lockfile and install dependencies + run: | + # Check if bun.lock exists, if not check for bun.lockb + if [ -f "bun.lock" ]; then + echo "Using existing bun.lock file" + elif [ -f "bun.lockb" ]; then + echo "Found bun.lockb, creating symlink to bun.lock" + ln -s bun.lockb bun.lock + fi + bun install - name: Run tests run: bunx vitest run diff --git a/.github/workflows/docker-scan.yml b/.github/workflows/docker-scan.yml index 7becd10..90eb88c 100644 --- a/.github/workflows/docker-scan.yml +++ b/.github/workflows/docker-scan.yml @@ -7,14 +7,14 @@ on: - 'Dockerfile' - '.dockerignore' - 'package.json' - - 'bun.lock' + - 'bun.lock*' pull_request: branches: [ main ] paths: - 'Dockerfile' - '.dockerignore' - 'package.json' - - 'bun.lock' + - 'bun.lock*' schedule: - cron: '0 0 * * 0' # Run weekly on Sunday at midnight diff --git a/Dockerfile b/Dockerfile index 2326bfa..e34e061 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,8 @@ RUN apk add --no-cache libc6-compat python3 make g++ gcc wget sqlite # ---------------------------- FROM base AS deps -COPY package.json bun.lock ./ +COPY package.json ./ +COPY bun.lock* ./ RUN bun install --frozen-lockfile # ----------------------------