Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
img-manager
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Lan
img-manager
Commits
cc4efa38
Commit
cc4efa38
authored
Mar 11, 2025
by
Ivan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update entrypoint
parent
876ec3a5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
5 deletions
+22
-5
Dockerfile
Dockerfile
+3
-2
docker-entrypoint
bin/docker-entrypoint
+19
-3
No files found.
Dockerfile
View file @
cc4efa38
...
...
@@ -29,7 +29,7 @@ RUN apt-get update -qq && \
ENV
RAILS_ENV="production" \
BUNDLE_DEPLOYMENT="1" \
BUNDLE_PATH="/bundle" \
BUNDLE_WITHOUT="development" \
BUNDLE_WITHOUT="development
:test
" \
BUNDLE_JOBS="4" \
BUNDLE_RETRY="3" \
MALLOC_ARENA_MAX="2" \
...
...
@@ -71,4 +71,5 @@ ENTRYPOINT ["/rails/bin/docker-entrypoint"]
# Start server via Thruster by default, this can be overwritten at runtime
EXPOSE
80
CMD
["/rails/code/bin/rails", "server"]
# 使用链接后的bin/rails路径,这样可以确保正确的环境变量和gem路径
CMD
["/rails/bin/rails", "server"]
bin/docker-entrypoint
View file @
cc4efa38
...
...
@@ -192,7 +192,7 @@ for dir in app bin config db lib public vendor; do
fi
done
# Link important files
# Link important files
and directories
for
file
in
Gemfile Gemfile.lock Rakefile config.ru package.json package-lock.json
;
do
if
[
-f
"/rails/code/
$file
"
]
;
then
ln
-sf
/rails/code/
$file
/rails/
$file
...
...
@@ -202,6 +202,14 @@ for file in Gemfile Gemfile.lock Rakefile config.ru package.json package-lock.js
fi
done
# Link bin directory for rails commands
if
[
-d
"/rails/code/bin"
]
;
then
echo
"Linking bin directory"
ln
-sf
/rails/code/bin /rails/bin
else
echo
"Warning: bin directory not found in /rails/code"
fi
# Link node_modules if it exists in the mounted volume
if
[
-d
"/rails/node_modules"
]
;
then
ln
-sfn
/rails/node_modules /rails/code/node_modules
...
...
@@ -217,12 +225,20 @@ if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
free
-h
||
echo
"free command not available"
df
-h
||
echo
"df command not available"
# 显示当前的bundle配置
echo
"Current bundle config:"
bundle config
if
[
!
-d
"
${
BUNDLE_PATH
}
/ruby"
]
||
[
"
$FORCE_BUNDLE_INSTALL
"
=
"true"
]
;
then
# 尝试使用更少的并发任务和内存
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"
bundle config
set
--local
without
"development:test"
# 确保正确的路径
echo
"BUNDLE_PATH is set to:
${
BUNDLE_PATH
}
"
mkdir
-p
"
${
BUNDLE_PATH
}
"
# 添加错误处理
if
!
bundle
install
;
then
...
...
@@ -231,7 +247,7 @@ if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
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"
find
"
${
BUNDLE_PATH
}
/extensions"
-name
"gem_make.out"
-exec
tail
-n
100
{}
\;
2>/dev/null
||
echo
"No gem_make.out files found"
exit
1
}
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment