-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat 1.x docker #56
Merged
Merged
Feat 1.x docker #56
Changes from 16 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
9c10eee
feat: add dockerfile
nankaNULL 4b2c18e
feat: shell
nankaNULL 4a9d2b8
Merge remote-tracking branch 'origin/master' into feat_1.x_docker
nankaNULL 4680975
feat: some change
nankaNULL ad9b068
Merge branch 'dev' into feat_1.x_docker
nankaNULL 0f8ab12
feat: config change
nankaNULL 444c8b1
fix: some config change, fix bugs, insert tag sql
nankaNULL c066b6d
chore: adjust directory structure
nankaNULL e92e1b8
fix: specify bash execution
nankaNULL 50e19fb
fix: fix shell bug, delete self info
nankaNULL 0457b9b
docs: docke deploy doc
nankaNULL 9dd3fd3
fix: write off mysql source path
nankaNULL 960dd35
docs: modify docker deploy doc
nankaNULL 67af36f
feat: distinguish between docker and prod configurations
nankaNULL e6170ce
docs: modify docs
nankaNULL 6e48e8c
fix: when web container stop, do not remove
nankaNULL a2f0bc2
fix: optimize config
nankaNULL e64c1c1
feat: add rm container function, rm container before build
nankaNULL b245d72
docs: modify docker deploy doc
nankaNULL 6bd5160
fix: fix shell bug
nankaNULL File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.vscode | ||
# node_modules/ | ||
# config/manifest.json | ||
run | ||
logs | ||
cache | ||
.history | ||
# public | ||
resources | ||
# app/view | ||
# .yarnrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM node:14.17.4-slim | ||
|
||
RUN mkdir -p /app/doraemon | ||
|
||
# RUN set -x && \ | ||
# echo "deb http://mirrors.aliyun.com/debian/ buster main non-free contrib" > /etc/apt/sources.list && \ | ||
# echo "deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib" >> /etc/apt/sources.list && \ | ||
# apt-get update && apt-get install -y --no-install-recommends \ | ||
# inetutils-ping \ | ||
# iproute2 \ | ||
# vim \ | ||
# ssh \ | ||
# curl \ | ||
# netcat-openbsd \ | ||
# libltdl7 \ | ||
# telnet \ | ||
# net-tools \ | ||
# && \ | ||
# apt-get clean && \ | ||
# rm -rf /var/lib/apt/lists/* | ||
|
||
COPY . /app/doraemon | ||
|
||
WORKDIR /app/doraemon | ||
|
||
CMD ["yarn", "server:docker"] | ||
|
||
EXPOSE 7002 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
yarn | ||
yarn build | ||
cd ./dockerScripts | ||
sh ./make.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
export image_mysql=172.16.84.121/dtstack-dev/doraemon_mysql | ||
|
||
export image_web=172.16.84.121/dtstack-dev/doraemon_web | ||
|
||
export version=0.0.2 | ||
|
||
export mysql_pwd=123456 | ||
|
||
export v_path=/home/app/doraemon_docker/data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/bash | ||
source ./const.sh | ||
|
||
# 导入 sql 文件 | ||
soucreSql() { | ||
containerId=$(docker ps -a | grep $image_mysql | awk '{print $1}') | ||
mysql_path=/app/doraemon/doraemon.sql | ||
docker exec -i $containerId mysql -uroot -p$mysql_pwd <<EOF | ||
source $mysql_path; | ||
ALTER USER 'root' IDENTIFIED WITH mysql_native_password BY '$mysql_pwd'; | ||
FLUSH PRIVILEGES; | ||
EOF | ||
} | ||
|
||
# 启动容器 | ||
reRunContainer() { | ||
imageName=$1:$version | ||
|
||
# 停止容器并删除 | ||
containerId=$(docker ps -a | grep $imageName | awk '{print $1}') | ||
if [[ $containerId ]]; then | ||
docker stop $containerId | ||
docker rm $containerId | ||
fi | ||
|
||
# 删除老镜像 | ||
imageId=$(docker images | grep $1 | awk '{print $3}') | ||
if [[ $imageId ]]; then | ||
docker rmi $imageId | ||
fi | ||
|
||
# 拉取镜像 | ||
docker image pull $imageName | ||
|
||
# 启动 | ||
if [[ $imageName =~ $image_web ]]; then | ||
docker run -d --net=host $imageName | ||
else | ||
docker run -d \ | ||
--name="doraemon_mysql" \ | ||
-v $v_path:/var/lib/mysql \ | ||
-e MYSQL_ROOT_HOST=% \ | ||
-e MYSQL_ROOT_PASSWORD=$mysql_pwd \ | ||
-p 3302:3306 \ | ||
$imageName | ||
|
||
sleep 11 | ||
if [[ $2 == '-volume' ]]; then | ||
mkdir -p $v_path | ||
soucreSql | ||
fi | ||
fi | ||
} | ||
|
||
if [[ $1 == 'web' ]]; then | ||
reRunContainer $image_web | ||
elif [[ $1 == 'mysql' ]]; then | ||
reRunContainer $image_mysql $2 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
sh make_mysql.sh | ||
sh make_web.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
source ./const.sh | ||
|
||
imageName=$image_mysql:$version | ||
|
||
docker build -t $imageName ../sql | ||
|
||
docker push $imageName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
source ./const.sh | ||
|
||
imageName=$image_web:$version | ||
|
||
docker build -t $imageName ../ | ||
|
||
docker push $imageName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
cd ./dockerScripts | ||
sh ./docker_start.sh mysql $1 | ||
sh ./docker_start.sh web |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ip 写到文档里,不要写到代码里