Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commitd9b3cb4

Browse files
committed
add deploy scripts
1 parente918c49 commitd9b3cb4

File tree

9 files changed

+113
-0
lines changed

9 files changed

+113
-0
lines changed

‎docker/dev/Dockerfile‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM node:8.11
2+
3+
RUN mkdir /root/admin_web
4+
5+
ADD web.tar.gz /root/admin_web
6+
RUN cd /root/admin_web/ && npm install --registry=https://registry.npm.taobao.org
7+
8+
ADD loader.sh /usr/local/bin/loader.sh
9+
RUN chmod +x /usr/local/bin/loader.sh
10+
CMD ["/usr/local/bin/loader.sh"]

‎docker/dev/loader.sh‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
cd /root/admin_web/
4+
5+
npm run launch&
6+
7+
whiletrue
8+
do
9+
sleep 100
10+
done

‎docker/dev/packer.sh‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
ENV="dev"
4+
5+
ARCHIVE_NAME="./docker/${ENV}/web.tar.gz"
6+
PACKER_TMP_DIR="./packer_tmp"
7+
TOTAL_STEPS=4
8+
9+
echo"[Step 1/${TOTAL_STEPS}] creating${PACKER_TMP_DIR} ..."
10+
if [-d"${PACKER_TMP_DIR}" ];then
11+
echo"remove${PACKER_TMP_DIR}"
12+
rm -rf"${PACKER_TMP_DIR}"
13+
fi
14+
mkdir"${PACKER_TMP_DIR}"
15+
16+
echo"[Step 2/${TOTAL_STEPS}] cp files to${PACKER_TMP_DIR} ..."
17+
# cp -rf pages lang containers components stores config static utils next.config.js .babelrc "${PACKER_TMP_DIR}"
18+
cp -rf pages lang containers components stores config static utils .babelrc"${PACKER_TMP_DIR}"
19+
cp package-docker.json"${PACKER_TMP_DIR}/package.json"
20+
21+
echo"[Step 3/${TOTAL_STEPS}] creating${ARCHIVE_NAME} ..."
22+
cd"${PACKER_TMP_DIR}"
23+
tar czvf"../${ARCHIVE_NAME}"* .babelrc
24+
cd ../
25+
26+
echo"[Step 4/${TOTAL_STEPS}] cleanup ..."
27+
rm -rf"${PACKER_TMP_DIR}"
28+
echo"--------------------------"
29+
echo"done !"

‎docker/dev/web.tar.gz‎

191 KB
Binary file not shown.

‎docker/production/Dockerfile‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM node:8.11
2+
3+
RUN mkdir /root/admin_web
4+
5+
ADD web.tar.gz /root/admin_web
6+
RUN cd /root/admin_web/ && npm install --registry=https://registry.npm.taobao.org
7+
8+
ADD loader.sh /usr/local/bin/loader.sh
9+
RUN chmod +x /usr/local/bin/loader.sh
10+
CMD ["/usr/local/bin/loader.sh"]

‎docker/production/loader.sh‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
cd /root/admin_web/
4+
5+
npm run launch&
6+
7+
whiletrue
8+
do
9+
sleep 100
10+
done

‎docker/production/packer.sh‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
ENV="production"
4+
5+
ARCHIVE_NAME="./docker/${ENV}/web.tar.gz"
6+
PACKER_TMP_DIR="./packer_tmp"
7+
TOTAL_STEPS=4
8+
9+
echo"[Step 1/${TOTAL_STEPS}] creating${PACKER_TMP_DIR} ..."
10+
if [-d"${PACKER_TMP_DIR}" ];then
11+
echo"remove${PACKER_TMP_DIR}"
12+
rm -rf"${PACKER_TMP_DIR}"
13+
fi
14+
mkdir"${PACKER_TMP_DIR}"
15+
16+
echo"[Step 2/${TOTAL_STEPS}] cp files to${PACKER_TMP_DIR} ..."
17+
# cp -rf pages lang containers components stores config static utils next.config.js .babelrc "${PACKER_TMP_DIR}"
18+
cp -rf pages lang containers components stores config static utils .babelrc"${PACKER_TMP_DIR}"
19+
cp package-docker.json"${PACKER_TMP_DIR}/package.json"
20+
21+
echo"[Step 3/${TOTAL_STEPS}] creating${ARCHIVE_NAME} ..."
22+
cd"${PACKER_TMP_DIR}"
23+
tar czvf"../${ARCHIVE_NAME}"* .babelrc
24+
cd ../
25+
26+
echo"[Step 4/${TOTAL_STEPS}] cleanup ..."
27+
rm -rf"${PACKER_TMP_DIR}"
28+
echo"--------------------------"
29+
echo"done !"

‎docker/production/web.tar.gz‎

191 KB
Binary file not shown.

‎publish.sh‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
ENV="$1"
4+
5+
if ["$ENV"=="prod" ];then
6+
echo"[Step 0/5] running ./docker/production/packer.sh"
7+
./docker/production/packer.sh
8+
elif ["$ENV"=="dev" ]
9+
then
10+
echo"[Step 0/5] running ./docker/dev/packer.sh"
11+
./docker/dev/packer.sh
12+
else
13+
echo"invalid publish env, support env: dev / prod"
14+
echo"usage: ./publish.sh dev OR ./publish.sh prod"
15+
fi

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp