Browse Source

添加 .docker 配置

liuyuqi 5 years ago
parent
commit
de59689d05
6 changed files with 65 additions and 55 deletions
  1. 2 0
      .devcontainer/Dockerfile
  2. 19 0
      .devcontainer/Dockerfile-dev
  3. 18 0
      .devcontainer/devcontainer.json
  4. 2 0
      .dockerignore
  5. 0 54
      Dockerfile-dev
  6. 24 1
      README.md

+ 2 - 0
.devcontainer/Dockerfile

@@ -0,0 +1,2 @@
+FROM hub.tencentyun.com/google/cordava-docs:v1.0.1
+

+ 19 - 0
.devcontainer/Dockerfile-dev

@@ -0,0 +1,19 @@
+FROM daocloud.io/library/ubuntu:18.10
+LABEL Name=google/cordova-docs Version=1.0.1
+
+WORKDIR /root/app
+
+RUN sed -i "s|http://archive.ubuntu.com|http://mirrors.aliyun.com|g" /etc/apt/sources.list && rm -Rf /var/lib/apt/lists/* && apt-get -y update
+
+RUN apt-get install -y ruby-full
+
+RUN apt-get install -y nodejs
+RUN apt-get install -y npm
+RUN npm config set registry http://registry.npm.taobao.org
+
+RUN apt-get install -y python2.7
+
+RUN gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
+RUN gem install bundler
+
+CMD ["/bin/bash" ,"-c" ,"while true;do echo hello docker;sleep 1;done"]

+ 18 - 0
.devcontainer/devcontainer.json

@@ -0,0 +1,18 @@
+// See https://aka.ms/vscode-remote/devcontainer.json for format details.
+{
+	"name": "Node.js 8",
+	"dockerFile": "Dockerfile",
+	
+	// Uncomment the next line if you want to publish any ports.
+	// "appPort": [],
+
+	// Uncomment the next line if you want to add in default container specific settings.json values
+	// "settings":  { "workbench.colorTheme": "Quiet Light" },
+
+	// Uncomment the next line to run commands after the container is created.
+	// "postCreateCommand": "yarn install",
+
+	"extensions": [
+		// "dbaeumer.vscode-eslint"
+	]
+}

+ 2 - 0
.dockerignore

@@ -1,4 +1,6 @@
 node_modules
+ruby_modules
+build-prod
 npm-debug.log
 Dockerfile*
 docker-compose*

+ 0 - 54
Dockerfile-dev

@@ -1,54 +0,0 @@
-FROM daocloud.io/library/ubuntu:18.10
-LABEL Name=google/cordova-docs Version=1.0.1
-
-WORKDIR /root/app
-
-RUN sed -i "s|http://archive.ubuntu.com|http://mirrors.aliyun.com|g" /etc/apt/sources.list && rm -Rf /var/lib/apt/lists/* && apt-get -y update
-
-RUN apt-get install -y ruby-full
-
-RUN apt-get install -y nodejs
-RUN apt-get install -y npm
-RUN npm config set registry http://registry.npm.taobao.org
-
-RUN apt-get install -y python2.7
-
-RUN gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
-RUN gem install bundler
-
-CMD ["/bin/bash" ,"-c" ,"while true;do echo hello docker;sleep 1;done"]
-
-
-
-
-docker run -d --privileged -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock  --restart=always  portainer/portainer:1.20.1
-
-## docker build --rm -f "Dockerfile-dev" -t cordova-docs:latest2 . 
-## docker-compose up -d
-
-####docker run -it cordova-docs:latest2 -v /home/ubuntu/cordova-docs/:/root/app/ /bin/bash
-
-## docker ps
-
-## docker exec -it b232abe3c967 /bin/bash
-
-bundle config mirror.https://rubygems.org https://gems.ruby-china.com
-bundle install --path ./ruby_modules
-
-部署:
-node_modules/.bin/gulp serve
-
-构建静态html文件
-node_modules/.bin/gulp build --prod
-
-## 构建镜像
-docker build -t hub.tencentyun.com/google/cordava-docs:v1.0.0 .
-
-1、登录 hub 
-docker login --username=google hub.tencentyun.com
-
-2、pull/push
-docker tag [ImageId] hub.tencentyun.com/google/cordava-docs:v1.0.0
-docker push hub.tencentyun.com/google/cordava-docs:v1.0.1
-
-

+ 24 - 1
README.md

@@ -11,13 +11,22 @@ The site is also reachable with the short domain [cordova.io](http://cordova.io)
 ```
 git clone https://github.com/jianboy/cordova-docs-cn.git
 
+<!-- docker build --rm -f "Dockerfile-dev" -t cordova-docs:latest2 .  -->
+
 docker-compose up -d
 
 docker attach containerid -it /bin/bash
 
 npm install
 
-npm run-script build
+bundle config mirror.https://rubygems.org https://gems.ruby-china.com
+bundle install --path ./ruby_modules
+
+<!-- 构建 -->
+npm run build
+
+<!-- run dev -->
+npm run serve
 
 ```
 
@@ -28,4 +37,18 @@ node tools/bin/toc.js www/docs www/_data/toc
 
 bundle exec jekyll build --config conf/_config.yml,conf/_defaults.yml,conf/_version.yml,conf/_prod.yml --watch
 
+```
+
+```
+docker run -it cordova-docs:latest2 -v /home/ubuntu/cordova-docs/:/root/app/ /bin/bash
+
+## 构建镜像
+docker build -t hub.tencentyun.com/google/cordava-docs:v1.0.0 .
+
+1、登录 hub 
+docker login --username=google hub.tencentyun.com
+
+2、pull/push
+docker tag [ImageId] hub.tencentyun.com/google/cordava-docs:v1.0.0
+docker push hub.tencentyun.com/google/cordava-docs:v1.0.1
 ```