Commit b44e4ec6 by Ivan

feat: update entrypoint

parent 93a73348
...@@ -14,5 +14,9 @@ ...@@ -14,5 +14,9 @@
# Replace 'your-docker-password' with your actual Docker Hub password # Replace 'your-docker-password' with your actual Docker Hub password
KAMAL_REGISTRY_PASSWORD=$(cat registry_password.key) KAMAL_REGISTRY_PASSWORD=$(cat registry_password.key)
# Git credentials for private repositories
# 这里使用SSH私钥的内容作为GIT_CREDENTIALS
GIT_CREDENTIALS=$(cat ~/.ssh/id_rsa)
# Improve security by using a password manager. Never check config/master.key into git! # Improve security by using a password manager. Never check config/master.key into git!
RAILS_MASTER_KEY=$(cat config/master.key) RAILS_MASTER_KEY=$(cat config/master.key)
...@@ -193,9 +193,12 @@ for dir in app bin config db lib public vendor; do ...@@ -193,9 +193,12 @@ for dir in app bin config db lib public vendor; do
done done
# Link important files # Link important files
for file in Gemfile Gemfile.lock Rakefile config.ru; do for file in Gemfile Gemfile.lock Rakefile config.ru package.json package-lock.json; do
if [ -f "/rails/code/$file" ]; then if [ -f "/rails/code/$file" ]; then
ln -sf /rails/code/$file /rails/$file ln -sf /rails/code/$file /rails/$file
echo "Linked $file"
else
echo "Warning: $file not found in /rails/code"
fi fi
done done
...@@ -218,12 +221,17 @@ if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then ...@@ -218,12 +221,17 @@ if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
fi fi
# Install Node.js dependencies if needed # Install Node.js dependencies if needed
echo "Installing Node.js dependencies..." echo "Checking for package.json..."
if [ ! -d "/rails/node_modules/node_modules" ] || [ "$FORCE_NPM_INSTALL" = "true" ]; then if [ -f "/rails/package.json" ]; then
npm install echo "Found package.json, installing Node.js dependencies..."
echo "✅ Node.js dependencies installed" if [ ! -d "/rails/node_modules/node_modules" ] || [ "$FORCE_NPM_INSTALL" = "true" ]; then
npm install
echo "✅ Node.js dependencies installed"
else
echo "✅ Node.js dependencies already installed"
fi
else else
echo "✅ Node.js dependencies already installed" echo "No package.json found in /rails, skipping npm install"
fi fi
# Prepare database files with proper permissions # Prepare database files with proper permissions
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment