พอหลังจากแก้ Code + Update Nuxt3 เสร็จ เราก็ push ปกติ สักพักตัว Pipeline ก็ Error
ERROR: failed to solve: process "/bin/sh -c bun install --frozen-lockfile" did not complete successfully: exit code: 1
ถ้าลองดูใน docker file จะเป็นบรรทัดที่ 5
# use the official Bun image # see all versions at https://hub.docker.com/r/oven/bun/tags FROM oven/bun:1 AS base WORKDIR /app # install dependencies into temp directory # this will cache them and speed up future builds FROM base AS install COPY package.json bun.lockb ./ COPY . . RUN bun install --frozen-lockfile # Copy project files into the image # [Optional] tests & build ENV NODE_ENV=production RUN bun run build # Copy production dependencies and source code into final image FROM oven/bun:1.0.18-alpine AS runtime WORKDIR /app # Copy necessary files from the 'install' stage to the 'runtime' stage # COPY --from=install /app/node_modules ./node_modules COPY --from=install /app/.output . # Set user and expose port USER bun EXPOSE 3000/tcp # Run the app ENTRYPOINT [ "sh", "-c", "bun run /app/server/index.mjs" ]
ถ้าเราลองเอาคำสั่งนี้มา Run แยกใน vs code จะเอา error เหมือนกันครับ มันจะแนะนำว่าลอง bun install
PS D:\2WarRoom\2024RedmineClient\redmine-client> bun install --frozen-lockfile [7.53ms] ".env" bun install v1.2.2 (c1708ea6) error: lockfile had changes, but lockfile is frozen note: try re-running without --frozen-lockfile and commit the updated lockfile
หลังจาก bun install ตัว bun สร้างไฟล์ bun.lockb
ส่วนสาเหตุที่ Error เนื่องจากตัว bun.lockb ตัว lib + dependencies ไม่ตรงกับไฟล์ package.json
ส่วนการแก้ไขให้
- bun install ตัว bun สร้างไฟล์ bun.lockb
- ถ้าลอง bun install --frozen-lockfile จะไม่ Error แล้ว
- จากนั้น commit ขึ้นไป bun.lockb ให้ GitHub Action ตรวจสอบก่อน
Discover more from naiwaen@DebuggingSoft
Subscribe to get the latest posts sent to your email.