Merge branch 'PR' into develop
commit
ccec8d98a2
|
@ -1,4 +1,11 @@
|
||||||
FROM nginx:latest
|
FROM node:latest as build-stage
|
||||||
|
WORKDIR /opt
|
||||||
|
COPY . .
|
||||||
|
RUN npm install --registry https://registry.npm.taobao.org
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
|
||||||
|
FROM nginx:latest as production-stage
|
||||||
|
|
||||||
# remove the default config
|
# remove the default config
|
||||||
RUN rm /etc/nginx/conf.d/default.conf && rm /etc/nginx/nginx.conf
|
RUN rm /etc/nginx/conf.d/default.conf && rm /etc/nginx/nginx.conf
|
||||||
|
@ -7,7 +14,8 @@ RUN rm /etc/nginx/conf.d/default.conf && rm /etc/nginx/nginx.conf
|
||||||
RUN mkdir -p /var/www/myems-web
|
RUN mkdir -p /var/www/myems-web
|
||||||
|
|
||||||
# Note: You should run 'npm run build' in the web direction to generate the production build.
|
# Note: You should run 'npm run build' in the web direction to generate the production build.
|
||||||
|
|
||||||
COPY nginx.conf /etc/nginx/
|
COPY nginx.conf /etc/nginx/
|
||||||
COPY ./build/ /var/www/myems-web
|
COPY --from=build-stage /opt/build/ /var/www/myems-web
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
CMD ["nginx", "-c", "/etc/nginx/nginx.conf", "-g", "daemon off;"]
|
CMD ["nginx", "-c", "/etc/nginx/nginx.conf", "-g", "daemon off;"]
|
|
@ -71,18 +71,10 @@ cd myems/myems-web
|
||||||
nano nginx.conf
|
nano nginx.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
* Download all the necessary dependencies into the node_modules directory.
|
|
||||||
```bash
|
|
||||||
npm i --unsafe-perm=true --allow-root --legacy-peer-deps
|
|
||||||
```
|
|
||||||
|
|
||||||
* Build for production with NPM
|
|
||||||
```bash
|
|
||||||
npm run build
|
|
||||||
```
|
|
||||||
|
|
||||||
* Build a Docker image
|
* Build a Docker image
|
||||||
|
|
||||||
|
**NOTE**: You can safely ignore the command 'npm run build' in this section, because it is built into the Dockerfile
|
||||||
|
|
||||||
On Windows:
|
On Windows:
|
||||||
```bash
|
```bash
|
||||||
cp -r myems/myems-web c:\myems-web
|
cp -r myems/myems-web c:\myems-web
|
||||||
|
|
Loading…
Reference in New Issue