As a backend programmer, sometimes I have to tinker with frontend stuff. So, my boss asked me to package the front-end project into a docker package. Okay, let’s stop talking nonsense. To install the docker package, you must first have a dockerfile, so let's write docker first Dockerfile FROM daocloud.io/node:7 MAINTAINER abel.yang <[email protected]> LABEL Description="This image is built for web" RUN mkdir -p /opt/apps/epp COPY . /opt/apps/epp WORKDIR /opt/apps/epp/epp-web/server ENV LANG C.UTF-8 ENV TZ=Asia/Shanghai RUN ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo Asia/Shanghai > /etc/timezone EXPOSE 3001 CMD [ "npm", "start" ] Okay, the Dockerfile is written and executes the image creation command. myeppweb is the name of the mirror I typed docker build -t myeppweb . // Note. Don't forget. start up At this time, execute docker images to view the successfully packaged image Execute the startup command: docker run -d -p 3001:3001 myeppweb analyze Okay, let me explain the command of dockerfile Package the image based on the image of daocloud.io/node:7 FROM daocloud.io/node:7 This is the maintainer's information.
Create a folder and move all the files in the current folder into the new folder. (The files in my current folder are the front-end executable code. You can run the code by simply typing npm run start) RUN mkdir -p /opt/apps/epp COPY . /opt/apps/epp Set the current path, that is, all the following commands are executed in this path WORKDIR /opt/apps/epp/epp-web/server Set the mirror time and time zone ENV LANG C.UTF-8 ENV TZ=Asia/Shanghai RUN ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo Asia/Shanghai > /etc/timezone Exposed Ports EXPOSE 3001 Start the node CMD [ "npm", "start" ] Well, this article just records the packaging process. Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links You may also be interested in:
|
<<: js dynamically implements table addition and deletion operations
>>: Vue implements login type switching
The offline installation method of MySQL_8.0.2 is...
1. Packetdrill compilation and installation Sourc...
1. Download MySQL Image Command: docker pull mysq...
Part 1: Basics 1. Unlike pseudo-classes such as :...
Install grafana. The official website provides an...
【Foreword】 Recently I want to stress test ITOO...
Preface This article mainly introduces the releva...
Background: I want to install a SAP ECC server an...
Table of contents Preface Can typeof correctly de...
This article example shares the specific code of ...
Index extension: InnoDB automatically extends eac...
View historical commands and execute specified co...
1. Add an empty element of the same type, and the...
The database, like the operating system, is a sha...
1. First log in to the Alibaba Cloud website to r...