diff --git a/.dockerignore b/.dockerignore index 12022d6e721bce0f34b43e1f3055509bf7925d66..8e90ca6d5026b261dd5e7af54bbe65eddda0a94b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,7 +5,6 @@ /src/utils/request-temp.js # production -/dist /.vscode # misc diff --git a/Dockerfile.hub b/Dockerfile.hub new file mode 100644 index 0000000000000000000000000000000000000000..2e9c1ec9133f1762656e6bdc2672a1802bd24186 --- /dev/null +++ b/Dockerfile.hub @@ -0,0 +1,11 @@ +FROM nginx + +WORKDIR /usr/src/app/ + +COPY ./docker/nginx.conf /etc/nginx/conf.d/default.conf + +COPY ./dist /usr/share/nginx/html/ + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/README.md b/README.md index 4f068a24d552243768fd8ffdcd3da88184f3d2df..6952f1099a6eff21415001c1ad0bdda30fef69ea 100644 --- a/README.md +++ b/README.md @@ -93,17 +93,22 @@ $ npm start # visit http://localhost:8000 ### Use by docker ```bash -// dev +# preview +$ docker pull chenshuai2144/ant-design-pro +$ docker run -p 80:80 chenshuai2144/ant-design-pro +# open http://localhost + +# dev $ npm run docker:dev -// build +# build $ npm run docker:build -// production dev +# production dev $ npm run docker-prod:dev -// production build +# production build $ npm run docker-prod:build ``` diff --git a/README.zh-CN.md b/README.zh-CN.md index d4aae9f34928b5915e5ebbbec0a78faf47381196..e1682437558d7af9a73d8fd8ce4de4eec4bce434 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -83,14 +83,19 @@ $ npm start # 访问 http://localhost:8000 ### 使用 docker ```bash -// dev +# preview +$ docker pull chenshuai2144/ant-design-pro +$ docker run -p 80:80 chenshuai2144/ant-design-pro +# open http://localhost + +# dev $ npm run docker:dev -// build +# build $ npm run docker:build -// production dev +# production dev $ npm run docker-prod:dev // production build diff --git a/package.json b/package.json index 28b06c80ea2d48aad277c3150a4f2939f6d3575d..8e0adabc299d53e0a58938b99bd21c6f04c903bb 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "start": "cross-env APP_TYPE=site umi dev", "start:no-mock": "cross-env MOCK=none umi dev", "build": "umi build", - "site": "npm run presite && cross-env APP_TYPE=site npm run build && firebase deploy", + "site": "npm run presite && cross-env APP_TYPE=site npm run build && firebase deploy && npm run docker:push", "analyze": "cross-env ANALYZE=1 umi build", "lint:style": "stylelint \"src/**/*.less\" --syntax less", "lint": "eslint --ext .js src mock tests && npm run lint:style", @@ -24,7 +24,10 @@ "docker:dev": "docker-compose -f ./docker/docker-compose.dev.yml up", "docker:build": "docker-compose -f ./docker/docker-compose.dev.yml build", "docker-prod:dev": "docker-compose -f ./docker/docker-compose.yml up", - "docker-prod:build": "docker-compose -f ./docker/docker-compose.yml build" + "docker-prod:build": "docker-compose -f ./docker/docker-compose.yml build", + "docker-hub:build":"docker build -f Dockerfile.hub -t ant-design-pro ./", + "docker:tag":"docker tag ant-design-pro chenshuai2144/ant-design-pro", + "docker:push":"npm run docker-hub:build && npm run docker:tag && docker push chenshuai2144/ant-design-pro" }, "dependencies": { "@babel/runtime": "^7.1.5",