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
Docker-compose deploys gitlab 1. Install Docker I...
Table of contents Routing Manager background gett...
1. CSS Navigation Bar (1) Function of the navigat...
I have encountered many centering problems recent...
Background: position: sticky is also called stick...
Here is how to install Tomcat-8.5.39 on centos7.6...
Table of contents Rendering API changes Render fu...
Table of contents Brief summary At noon today, th...
If you open some Microsoft documents with LibreOf...
Table of contents Problem Description Solution Pr...
Table of contents 1. Introduction 2. Introduction...
I slept late yesterday and was awake the whole da...
Table of contents 1. Declare a function 2. Callin...
First put a piece of code for(int i=0;i<1000;i...
New features in MySQL 8.0 include: Full out-of-th...