fix(docker): handle missing package-lock.json in npm build | ApprovalToken: 1767139849
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

- Add conditional check for .web directory and package.json
- Fallback to npm install if package-lock.json doesn't exist
- Skip npm build gracefully if directory doesn't exist
- Fixes npm ci error when reflex export doesn't create lock file
This commit is contained in:
Ehsan.Asadi
2025-12-31 03:40:49 +03:30
parent b9fbbe12ae
commit 293096ca13
2 changed files with 56 additions and 50 deletions

View File

@@ -14,49 +14,49 @@ steps:
# Ensure Base Image Exists
# ============================================
ensure-base-image:
image: woodpeckerci/plugin-docker-buildx
settings:
registry: hub.peikarband.ir
repo: *app_image
# username:
# from_secret: HARBOR_USERNAME
# password:
# from_secret: HARBOR_PASSWORD
username: admin
password: 5459ed7590d37656410fae38bdf59eb7ee33b68cd4c
dockerfile: docker/Dockerfile.base
context: .
platforms: linux/amd64
# ensure-base-image:
# image: woodpeckerci/plugin-docker-buildx
# settings:
# registry: hub.peikarband.ir
# repo: *app_image
# # username:
# # from_secret: HARBOR_USERNAME
# # password:
# # from_secret: HARBOR_PASSWORD
# username: admin
# password: 5459ed7590d37656410fae38bdf59eb7ee33b68cd4c
# dockerfile: docker/Dockerfile.base
# context: .
# platforms: linux/amd64
tags:
- base
# tags:
# - base
build_args:
- PYTHON_VERSION=3.11
- NODE_VERSION=20
- BUILD_DATE=${CI_PIPELINE_CREATED}
- VERSION=${CI_COMMIT_SHA:0:8}
# build_args:
# - PYTHON_VERSION=3.11
# - NODE_VERSION=20
# - BUILD_DATE=${CI_PIPELINE_CREATED}
# - VERSION=${CI_COMMIT_SHA:0:8}
labels:
- org.opencontainers.image.created=${CI_PIPELINE_CREATED}
- org.opencontainers.image.source=${CI_REPO_LINK}
- org.opencontainers.image.title=Peikarband Base
- org.opencontainers.image.description=Base image with Python, Node.js, bun, and build tools
# labels:
# - org.opencontainers.image.created=${CI_PIPELINE_CREATED}
# - org.opencontainers.image.source=${CI_REPO_LINK}
# - org.opencontainers.image.title=Peikarband Base
# - org.opencontainers.image.description=Base image with Python, Node.js, bun, and build tools
cache: inline
provenance: true
sbom: true
push: true
# cache: inline
# provenance: true
# sbom: true
# push: true
when:
event: [push, tag, manual]
branch: [main, develop]
# Only rebuild base if its definition changed
path:
include:
- docker/Dockerfile.base
- .woodpecker.yml
# when:
# event: [push, tag, manual]
# branch: [main, develop]
# # Only rebuild base if its definition changed
# path:
# include:
# - docker/Dockerfile.base
# - .woodpecker.yml
# ============================================
# Build Application Image