forked from baron/baron-sso
fix(deploy): resolve frontend deployment failure by fixing workspace detection and dependency installation
This commit is contained in:
@@ -9,11 +9,12 @@ ENV CI=true
|
|||||||
RUN corepack enable && corepack prepare pnpm@10.5.2 --activate
|
RUN corepack enable && corepack prepare pnpm@10.5.2 --activate
|
||||||
|
|
||||||
# Copy workspace configs and common package
|
# Copy workspace configs and common package
|
||||||
|
COPY pnpm-workspace.yaml pnpm-lock.yaml ./
|
||||||
COPY common ./common
|
COPY common ./common
|
||||||
COPY adminfront ./adminfront
|
COPY adminfront ./adminfront
|
||||||
|
|
||||||
# Install dependencies for the workspace
|
# Install dependencies for the workspace
|
||||||
RUN cd common && pnpm install --no-frozen-lockfile --ignore-scripts
|
RUN pnpm install --filter adminfront... --filter baron-sso... --no-frozen-lockfile --ignore-scripts
|
||||||
|
|
||||||
# 프로덕션 서빙을 위한 serve 패키지 글로벌 설치
|
# 프로덕션 서빙을 위한 serve 패키지 글로벌 설치
|
||||||
RUN npm install -g serve
|
RUN npm install -g serve
|
||||||
|
|||||||
@@ -36,15 +36,30 @@ if [ "${1:-}" = "--print-mode" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
ensure_frontend_dependencies() {
|
ensure_frontend_dependencies() {
|
||||||
APP_WORKSPACE_FILTER="../adminfront"
|
APP_PACKAGE_NAME="adminfront"
|
||||||
|
|
||||||
# If common workspace exists, manage dependencies from the real workspace tree.
|
# Detect workspace root
|
||||||
if [ -d /workspace/common ] && [ -f /workspace/common/package.json ]; then
|
if [ -f "/workspace/pnpm-workspace.yaml" ]; then
|
||||||
WORKSPACE_DIR="/workspace/common"
|
WORKSPACE_ROOT="/workspace"
|
||||||
LOCK_FILE="/workspace/common/pnpm-lock.yaml"
|
elif [ -f "../../pnpm-workspace.yaml" ]; then
|
||||||
|
WORKSPACE_ROOT="../.."
|
||||||
|
else
|
||||||
|
WORKSPACE_ROOT=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Manage dependencies from the real workspace tree if possible, otherwise use current dir.
|
||||||
|
if [ -n "$WORKSPACE_ROOT" ]; then
|
||||||
|
WORKSPACE_DIR="$WORKSPACE_ROOT"
|
||||||
|
LOCK_FILE="$WORKSPACE_ROOT/pnpm-lock.yaml"
|
||||||
|
INSTALL_CMD="cd $WORKSPACE_ROOT && CI=true pnpm install --filter ${APP_PACKAGE_NAME}... --frozen-lockfile --ignore-scripts"
|
||||||
|
elif [ -f "pnpm-lock.yaml" ]; then
|
||||||
|
WORKSPACE_DIR="."
|
||||||
|
LOCK_FILE="pnpm-lock.yaml"
|
||||||
|
INSTALL_CMD="CI=true pnpm install --frozen-lockfile --ignore-scripts"
|
||||||
else
|
else
|
||||||
WORKSPACE_DIR="."
|
WORKSPACE_DIR="."
|
||||||
LOCK_FILE="package-lock.json"
|
LOCK_FILE="package-lock.json"
|
||||||
|
INSTALL_CMD="npm ci"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "$WORKSPACE_DIR/package.json" ]; then
|
if [ ! -f "$WORKSPACE_DIR/package.json" ]; then
|
||||||
@@ -85,9 +100,9 @@ ensure_frontend_dependencies() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if command -v sha256sum >/dev/null 2>&1; then
|
if command -v sha256sum >/dev/null 2>&1; then
|
||||||
deps_hash="$(sha256sum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" 2>/dev/null | sha256sum | awk '{print $1}')"
|
deps_hash="$(sha256sum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" package.json 2>/dev/null | sha256sum | awk '{print $1}')"
|
||||||
else
|
else
|
||||||
deps_hash="$(cksum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" 2>/dev/null | cksum | awk '{print $1}')"
|
deps_hash="$(cksum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" package.json 2>/dev/null | cksum | awk '{print $1}')"
|
||||||
fi
|
fi
|
||||||
deps_stamp="node_modules/.baron-deps-hash"
|
deps_stamp="node_modules/.baron-deps-hash"
|
||||||
installed_hash="$(cat "$deps_stamp" 2>/dev/null || true)"
|
installed_hash="$(cat "$deps_stamp" 2>/dev/null || true)"
|
||||||
@@ -96,20 +111,18 @@ ensure_frontend_dependencies() {
|
|||||||
echo "Installing frontend dependencies..."
|
echo "Installing frontend dependencies..."
|
||||||
acquire_install_lock
|
acquire_install_lock
|
||||||
if command -v sha256sum >/dev/null 2>&1; then
|
if command -v sha256sum >/dev/null 2>&1; then
|
||||||
deps_hash="$(sha256sum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" 2>/dev/null | sha256sum | awk '{print $1}')"
|
deps_hash="$(sha256sum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" package.json 2>/dev/null | sha256sum | awk '{print $1}')"
|
||||||
else
|
else
|
||||||
deps_hash="$(cksum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" 2>/dev/null | cksum | awk '{print $1}')"
|
deps_hash="$(cksum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" package.json 2>/dev/null | cksum | awk '{print $1}')"
|
||||||
fi
|
fi
|
||||||
installed_hash="$(cat "$deps_stamp" 2>/dev/null || true)"
|
installed_hash="$(cat "$deps_stamp" 2>/dev/null || true)"
|
||||||
if [ "$installed_hash" = "$deps_hash" ]; then
|
if [ "$installed_hash" = "$deps_hash" ]; then
|
||||||
release_install_lock
|
release_install_lock
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if [ "$WORKSPACE_DIR" = "/workspace/common" ]; then
|
|
||||||
(cd /workspace/common && CI=true pnpm install --filter "${APP_WORKSPACE_FILTER}..." --frozen-lockfile --ignore-scripts)
|
eval "$INSTALL_CMD"
|
||||||
else
|
|
||||||
npm ci
|
|
||||||
fi
|
|
||||||
mkdir -p node_modules
|
mkdir -p node_modules
|
||||||
printf '%s\n' "$deps_hash" > "$deps_stamp"
|
printf '%s\n' "$deps_hash" > "$deps_stamp"
|
||||||
release_install_lock
|
release_install_lock
|
||||||
|
|||||||
@@ -9,11 +9,12 @@ ENV CI=true
|
|||||||
RUN corepack enable && corepack prepare pnpm@10.5.2 --activate
|
RUN corepack enable && corepack prepare pnpm@10.5.2 --activate
|
||||||
|
|
||||||
# Copy workspace configs and common package
|
# Copy workspace configs and common package
|
||||||
|
COPY pnpm-workspace.yaml pnpm-lock.yaml ./
|
||||||
COPY common ./common
|
COPY common ./common
|
||||||
COPY devfront ./devfront
|
COPY devfront ./devfront
|
||||||
|
|
||||||
# Install dependencies for the workspace
|
# Install dependencies for the workspace
|
||||||
RUN cd common && pnpm install --no-frozen-lockfile --ignore-scripts
|
RUN pnpm install --filter devfront... --filter baron-sso... --no-frozen-lockfile --ignore-scripts
|
||||||
|
|
||||||
# 프로덕션 서빙을 위한 serve 패키지 글로벌 설치
|
# 프로덕션 서빙을 위한 serve 패키지 글로벌 설치
|
||||||
RUN npm install -g serve
|
RUN npm install -g serve
|
||||||
|
|||||||
@@ -36,15 +36,30 @@ if [ "${1:-}" = "--print-mode" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
ensure_frontend_dependencies() {
|
ensure_frontend_dependencies() {
|
||||||
APP_WORKSPACE_FILTER="../devfront"
|
APP_PACKAGE_NAME="devfront"
|
||||||
|
|
||||||
# If common workspace exists, manage dependencies from the real workspace tree.
|
# Detect workspace root
|
||||||
if [ -d /workspace/common ] && [ -f /workspace/common/package.json ]; then
|
if [ -f "/workspace/pnpm-workspace.yaml" ]; then
|
||||||
WORKSPACE_DIR="/workspace/common"
|
WORKSPACE_ROOT="/workspace"
|
||||||
LOCK_FILE="/workspace/common/pnpm-lock.yaml"
|
elif [ -f "../../pnpm-workspace.yaml" ]; then
|
||||||
|
WORKSPACE_ROOT="../.."
|
||||||
|
else
|
||||||
|
WORKSPACE_ROOT=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Manage dependencies from the real workspace tree if possible, otherwise use current dir.
|
||||||
|
if [ -n "$WORKSPACE_ROOT" ]; then
|
||||||
|
WORKSPACE_DIR="$WORKSPACE_ROOT"
|
||||||
|
LOCK_FILE="$WORKSPACE_ROOT/pnpm-lock.yaml"
|
||||||
|
INSTALL_CMD="cd $WORKSPACE_ROOT && CI=true pnpm install --filter ${APP_PACKAGE_NAME}... --frozen-lockfile --ignore-scripts"
|
||||||
|
elif [ -f "pnpm-lock.yaml" ]; then
|
||||||
|
WORKSPACE_DIR="."
|
||||||
|
LOCK_FILE="pnpm-lock.yaml"
|
||||||
|
INSTALL_CMD="CI=true pnpm install --frozen-lockfile --ignore-scripts"
|
||||||
else
|
else
|
||||||
WORKSPACE_DIR="."
|
WORKSPACE_DIR="."
|
||||||
LOCK_FILE="package-lock.json"
|
LOCK_FILE="package-lock.json"
|
||||||
|
INSTALL_CMD="npm ci"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "$WORKSPACE_DIR/package.json" ]; then
|
if [ ! -f "$WORKSPACE_DIR/package.json" ]; then
|
||||||
@@ -85,9 +100,9 @@ ensure_frontend_dependencies() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if command -v sha256sum >/dev/null 2>&1; then
|
if command -v sha256sum >/dev/null 2>&1; then
|
||||||
deps_hash="$(sha256sum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" 2>/dev/null | sha256sum | awk '{print $1}')"
|
deps_hash="$(sha256sum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" package.json 2>/dev/null | sha256sum | awk '{print $1}')"
|
||||||
else
|
else
|
||||||
deps_hash="$(cksum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" 2>/dev/null | cksum | awk '{print $1}')"
|
deps_hash="$(cksum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" package.json 2>/dev/null | cksum | awk '{print $1}')"
|
||||||
fi
|
fi
|
||||||
deps_stamp="node_modules/.baron-deps-hash"
|
deps_stamp="node_modules/.baron-deps-hash"
|
||||||
installed_hash="$(cat "$deps_stamp" 2>/dev/null || true)"
|
installed_hash="$(cat "$deps_stamp" 2>/dev/null || true)"
|
||||||
@@ -96,20 +111,18 @@ ensure_frontend_dependencies() {
|
|||||||
echo "Installing frontend dependencies..."
|
echo "Installing frontend dependencies..."
|
||||||
acquire_install_lock
|
acquire_install_lock
|
||||||
if command -v sha256sum >/dev/null 2>&1; then
|
if command -v sha256sum >/dev/null 2>&1; then
|
||||||
deps_hash="$(sha256sum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" 2>/dev/null | sha256sum | awk '{print $1}')"
|
deps_hash="$(sha256sum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" package.json 2>/dev/null | sha256sum | awk '{print $1}')"
|
||||||
else
|
else
|
||||||
deps_hash="$(cksum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" 2>/dev/null | cksum | awk '{print $1}')"
|
deps_hash="$(cksum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" package.json 2>/dev/null | cksum | awk '{print $1}')"
|
||||||
fi
|
fi
|
||||||
installed_hash="$(cat "$deps_stamp" 2>/dev/null || true)"
|
installed_hash="$(cat "$deps_stamp" 2>/dev/null || true)"
|
||||||
if [ "$installed_hash" = "$deps_hash" ]; then
|
if [ "$installed_hash" = "$deps_hash" ]; then
|
||||||
release_install_lock
|
release_install_lock
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if [ "$WORKSPACE_DIR" = "/workspace/common" ]; then
|
|
||||||
(cd /workspace/common && CI=true pnpm install --filter "${APP_WORKSPACE_FILTER}..." --frozen-lockfile --ignore-scripts)
|
eval "$INSTALL_CMD"
|
||||||
else
|
|
||||||
npm ci
|
|
||||||
fi
|
|
||||||
mkdir -p node_modules
|
mkdir -p node_modules
|
||||||
printf '%s\n' "$deps_hash" > "$deps_stamp"
|
printf '%s\n' "$deps_hash" > "$deps_stamp"
|
||||||
release_install_lock
|
release_install_lock
|
||||||
|
|||||||
@@ -9,11 +9,12 @@ ENV CI=true
|
|||||||
RUN corepack enable && corepack prepare pnpm@10.5.2 --activate
|
RUN corepack enable && corepack prepare pnpm@10.5.2 --activate
|
||||||
|
|
||||||
# Copy workspace configs and common package
|
# Copy workspace configs and common package
|
||||||
|
COPY pnpm-workspace.yaml pnpm-lock.yaml ./
|
||||||
COPY common ./common
|
COPY common ./common
|
||||||
COPY orgfront ./orgfront
|
COPY orgfront ./orgfront
|
||||||
|
|
||||||
# Install dependencies for the workspace
|
# Install dependencies for the workspace
|
||||||
RUN cd common && pnpm install --no-frozen-lockfile --ignore-scripts
|
RUN pnpm install --filter orgfront... --filter baron-sso... --no-frozen-lockfile --ignore-scripts
|
||||||
|
|
||||||
# 프로덕션 서빙을 위한 serve 패키지 글로벌 설치
|
# 프로덕션 서빙을 위한 serve 패키지 글로벌 설치
|
||||||
RUN npm install -g serve
|
RUN npm install -g serve
|
||||||
|
|||||||
@@ -36,15 +36,30 @@ if [ "${1:-}" = "--print-mode" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
ensure_frontend_dependencies() {
|
ensure_frontend_dependencies() {
|
||||||
APP_WORKSPACE_FILTER="../orgfront"
|
APP_PACKAGE_NAME="orgfront"
|
||||||
|
|
||||||
# If common workspace exists, manage dependencies from the real workspace tree.
|
# Detect workspace root
|
||||||
if [ -d /workspace/common ] && [ -f /workspace/common/package.json ]; then
|
if [ -f "/workspace/pnpm-workspace.yaml" ]; then
|
||||||
WORKSPACE_DIR="/workspace/common"
|
WORKSPACE_ROOT="/workspace"
|
||||||
LOCK_FILE="/workspace/common/pnpm-lock.yaml"
|
elif [ -f "../../pnpm-workspace.yaml" ]; then
|
||||||
|
WORKSPACE_ROOT="../.."
|
||||||
|
else
|
||||||
|
WORKSPACE_ROOT=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Manage dependencies from the real workspace tree if possible, otherwise use current dir.
|
||||||
|
if [ -n "$WORKSPACE_ROOT" ]; then
|
||||||
|
WORKSPACE_DIR="$WORKSPACE_ROOT"
|
||||||
|
LOCK_FILE="$WORKSPACE_ROOT/pnpm-lock.yaml"
|
||||||
|
INSTALL_CMD="cd $WORKSPACE_ROOT && CI=true pnpm install --filter ${APP_PACKAGE_NAME}... --frozen-lockfile --ignore-scripts"
|
||||||
|
elif [ -f "pnpm-lock.yaml" ]; then
|
||||||
|
WORKSPACE_DIR="."
|
||||||
|
LOCK_FILE="pnpm-lock.yaml"
|
||||||
|
INSTALL_CMD="CI=true pnpm install --frozen-lockfile --ignore-scripts"
|
||||||
else
|
else
|
||||||
WORKSPACE_DIR="."
|
WORKSPACE_DIR="."
|
||||||
LOCK_FILE="package-lock.json"
|
LOCK_FILE="package-lock.json"
|
||||||
|
INSTALL_CMD="npm ci"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "$WORKSPACE_DIR/package.json" ]; then
|
if [ ! -f "$WORKSPACE_DIR/package.json" ]; then
|
||||||
@@ -85,9 +100,9 @@ ensure_frontend_dependencies() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if command -v sha256sum >/dev/null 2>&1; then
|
if command -v sha256sum >/dev/null 2>&1; then
|
||||||
deps_hash="$(sha256sum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" 2>/dev/null | sha256sum | awk '{print $1}')"
|
deps_hash="$(sha256sum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" package.json 2>/dev/null | sha256sum | awk '{print $1}')"
|
||||||
else
|
else
|
||||||
deps_hash="$(cksum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" 2>/dev/null | cksum | awk '{print $1}')"
|
deps_hash="$(cksum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" package.json 2>/dev/null | cksum | awk '{print $1}')"
|
||||||
fi
|
fi
|
||||||
deps_stamp="node_modules/.baron-deps-hash"
|
deps_stamp="node_modules/.baron-deps-hash"
|
||||||
installed_hash="$(cat "$deps_stamp" 2>/dev/null || true)"
|
installed_hash="$(cat "$deps_stamp" 2>/dev/null || true)"
|
||||||
@@ -96,20 +111,18 @@ ensure_frontend_dependencies() {
|
|||||||
echo "Installing frontend dependencies..."
|
echo "Installing frontend dependencies..."
|
||||||
acquire_install_lock
|
acquire_install_lock
|
||||||
if command -v sha256sum >/dev/null 2>&1; then
|
if command -v sha256sum >/dev/null 2>&1; then
|
||||||
deps_hash="$(sha256sum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" 2>/dev/null | sha256sum | awk '{print $1}')"
|
deps_hash="$(sha256sum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" package.json 2>/dev/null | sha256sum | awk '{print $1}')"
|
||||||
else
|
else
|
||||||
deps_hash="$(cksum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" 2>/dev/null | cksum | awk '{print $1}')"
|
deps_hash="$(cksum "$WORKSPACE_DIR/package.json" "$LOCK_FILE" package.json 2>/dev/null | cksum | awk '{print $1}')"
|
||||||
fi
|
fi
|
||||||
installed_hash="$(cat "$deps_stamp" 2>/dev/null || true)"
|
installed_hash="$(cat "$deps_stamp" 2>/dev/null || true)"
|
||||||
if [ "$installed_hash" = "$deps_hash" ]; then
|
if [ "$installed_hash" = "$deps_hash" ]; then
|
||||||
release_install_lock
|
release_install_lock
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if [ "$WORKSPACE_DIR" = "/workspace/common" ]; then
|
|
||||||
(cd /workspace/common && CI=true pnpm install --filter "${APP_WORKSPACE_FILTER}..." --frozen-lockfile --ignore-scripts)
|
eval "$INSTALL_CMD"
|
||||||
else
|
|
||||||
npm ci
|
|
||||||
fi
|
|
||||||
mkdir -p node_modules
|
mkdir -p node_modules
|
||||||
printf '%s\n' "$deps_hash" > "$deps_stamp"
|
printf '%s\n' "$deps_hash" > "$deps_stamp"
|
||||||
release_install_lock
|
release_install_lock
|
||||||
|
|||||||
Reference in New Issue
Block a user