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
ccdaa62a
Commit
ccdaa62a
authored
Mar 11, 2025
by
Ivan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update deploy
parent
e1b89d94
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
1 deletion
+47
-1
docker-entrypoint
bin/docker-entrypoint
+46
-0
deploy.yml
config/deploy.yml
+1
-1
No files found.
bin/docker-entrypoint
View file @
ccdaa62a
...
...
@@ -34,6 +34,52 @@ echo "after Setting up directories..."
# Wait for external volumes to be properly mounted
sleep
5
# 设置SSH配置以解决Host key verification failed问题
echo
"Setting up SSH configuration..."
# 确保.ssh目录存在并具有正确的权限
mkdir
-p
~/.ssh
chmod
700 ~/.ssh
# 如果存在挂载的SSH目录,确保我们可以使用其中的密钥
if
[
-d
"/root/.ssh"
]
;
then
echo
"Found mounted SSH directory, configuring access..."
# 复制SSH密钥到当前用户的.ssh目录
cp
-f
/root/.ssh/id_
*
~/.ssh/ 2>/dev/null
||
echo
"No SSH keys found in mounted directory"
cp
-f
/root/.ssh/config ~/.ssh/ 2>/dev/null
||
echo
"No SSH config found in mounted directory"
# 确保密钥文件有正确的权限
chmod
600 ~/.ssh/id_
*
2>/dev/null
||
echo
"No SSH keys to chmod"
# 如果存在known_hosts文件,也复制它
if
[
-f
"/root/.ssh/known_hosts"
]
;
then
cp
-f
/root/.ssh/known_hosts ~/.ssh/
else
# 如果没有known_hosts文件,创建一个空文件
touch
~/.ssh/known_hosts
fi
# 禁用StrictHostKeyChecking以自动接受新的host keys
if
[
!
-f
"~/.ssh/config"
]
;
then
echo
"Creating SSH config to disable strict host key checking..."
cat
>
~/.ssh/config
<<
'
EOL
'
Host *
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
EOL
chmod
600 ~/.ssh/config
fi
fi
# 测试SSH连接
echo
"Testing SSH connection to Git repository host..."
GIT_HOST
=
$(
echo
"
${
GIT_REPOSITORY
}
"
|
sed
-E
's/.*@([^:]+):.*/\1/'
)
if
[
"
${
GIT_HOST
}
"
!=
"
${
GIT_REPOSITORY
}
"
]
;
then
echo
"Detected Git host:
${
GIT_HOST
}
"
ssh
-T
-o
StrictHostKeyChecking
=
no
-o
UserKnownHostsFile
=
/dev/null
${
GIT_HOST
}
2>&1
||
echo
"SSH connection test completed with non-zero exit code, but we'll continue anyway"
fi
# Check if code directory is empty or if we need to clone/pull the repository
if
[
-z
"
${
GIT_REPOSITORY
}
"
]
;
then
echo
"⚠️ GIT_REPOSITORY environment variable not set. Using mounted code directory."
...
...
config/deploy.yml
View file @
ccdaa62a
...
...
@@ -101,7 +101,7 @@ volumes:
-
"
/root/img_manager/logs:/rails/log"
# Tmp directory for pids and other temporary files
-
"
/root/img_manager/tmp:/rails/tmp"
-
"
/root/.ssh:/
root
/.ssh"
-
"
/root/.ssh:/
home/rails
/.ssh"
# Bridge fingerprinted assets, like JS and CSS, between versions to avoid
...
...
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