forked from baron/baron-sso
레포 업데이트
This commit is contained in:
@@ -16,10 +16,5 @@ COPY . .
|
||||
EXPOSE 5173
|
||||
|
||||
# 실행 스크립트: APP_ENV에 따라 개발 서버 또는 빌드 후 서빙
|
||||
CMD sh -c "if [ \"$APP_ENV\" = 'production' ]; then \
|
||||
echo 'Running in production mode...'; \
|
||||
npm run build && serve -s dist -l 5173; \
|
||||
else \
|
||||
echo 'Running in development mode...'; \
|
||||
npm run dev -- --host 0.0.0.0; \
|
||||
fi"
|
||||
RUN chmod +x ./scripts/runtime-mode.sh
|
||||
CMD ["sh", "./scripts/runtime-mode.sh"]
|
||||
|
||||
26
devfront/scripts/runtime-mode.sh
Normal file
26
devfront/scripts/runtime-mode.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
app_env="$(printf '%s' "${APP_ENV:-development}" | tr '[:upper:]' '[:lower:]')"
|
||||
|
||||
case "$app_env" in
|
||||
production|prod|stage|staging)
|
||||
mode="production"
|
||||
;;
|
||||
*)
|
||||
mode="development"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${1:-}" = "--print-mode" ]; then
|
||||
printf '%s\n' "$mode"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$mode" = "production" ]; then
|
||||
echo "Running in production mode..."
|
||||
exec sh -c "npm run build && serve -s dist -l 5173"
|
||||
fi
|
||||
|
||||
echo "Running in development mode..."
|
||||
exec npm run dev -- --host 0.0.0.0
|
||||
Reference in New Issue
Block a user