Commit 803cda13 by Ivan

feat: update entrypoint

parent b44e4ec6
......@@ -25,11 +25,16 @@ RUN apt-get update -qq && \
pkg-config \
&& rm -rf /var/lib/apt/lists /var/cache/apt/archives
# Set production environment
# Set production environment and optimize memory usage
ENV RAILS_ENV="production" \
BUNDLE_DEPLOYMENT="1" \
BUNDLE_PATH="/usr/local/bundle" \
BUNDLE_WITHOUT="development"
BUNDLE_WITHOUT="development" \
BUNDLE_JOBS="4" \
BUNDLE_RETRY="3" \
MALLOC_ARENA_MAX="2" \
LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libjemalloc.so.2" \
JEMALLOC_CONF="background_thread:true,metadata_thp:auto,dirty_decay_ms:30000,muzzy_decay_ms:30000"
# Create directories for mounted volumes
RUN mkdir -p \
......
......@@ -213,9 +213,33 @@ if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
# Install Ruby dependencies if needed
echo "Installing Ruby dependencies..."
echo "Memory stats before bundle install:"
free -h || echo "free command not available"
df -h || echo "df command not available"
if [ ! -d "${BUNDLE_PATH}/ruby" ] || [ "$FORCE_BUNDLE_INSTALL" = "true" ]; then
bundle install
# 尝试使用更少的并发任务和内存
echo "Running bundle install with optimized settings..."
bundle config set --local jobs 2
bundle config set --local retry 3
bundle config set --local without "development test"
# 添加错误处理
if ! bundle install; then
echo "❌ Bundle install failed!"
echo "Trying again with more verbose output..."
bundle install --verbose || {
echo "❌ Bundle install failed again!"
echo "Last 100 lines of gem installation logs:"
find /usr/local/bundle/extensions -name "gem_make.out" -exec tail -n 100 {} \; 2>/dev/null || echo "No gem_make.out files found"
exit 1
}
fi
echo "✅ Ruby dependencies installed"
echo "Memory stats after bundle install:"
free -h || echo "free command not available"
df -h || echo "df command not available"
else
echo "✅ Ruby dependencies already installed"
fi
......
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