In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to deploy react front-end code to generate docker image based on centos through nginx. The article is very detailed and has a certain reference value. Interested friends must read it!
The content of 1.Dockerfile file is as follows
FROM centos:centos7
MAINTAINER dengyunshuo
ADD http://nginx.org/download/nginx-1.15.3.tar.gz.
RUN yum install-y pcre-devel wget net-tools gcc zlib zlib-devel make openssl-devel
RUN tar-zxvf nginx-1.15.3.tar.gz
RUN mkdir-p / usr/local/nginx
RUN cd nginx-1.15.3 &. / configure & & make & & make install
RUN ln-s / usr/local/nginx/sbin/* / usr/local/sbin/
RUN rm / usr/local/nginx/conf/nginx.conf
ADD nginx.conf / usr/local/nginx/conf/
RUN rm / usr/local/nginx/html/index.html
RUN mkdir-p / usr/local/nginx/html/static
COPY dist/ / usr/local/nginx/html/static
EXPOSE 80
CMD ["nginx"]
two。 Front-end Project dist folder
Dist
|-img
|-index.html
|-static
|-umi.css
|-umi.css.map
|-umi.js
|-umi.js.map
3.nginx.conf profile
Daemon off
User root
Worker_processes 4
Events {
Worker_connections 1024
}
Http {
Include mime.types
Default_type application/octet-stream
Sendfile on
Keepalive_timeout 65
Server {
Listen 80
Server_name localhost
Location / {
Add_header Access-Control-Allow-Origin'*'; # allow access from all addresses
Add_header Access-Control-Allow-Credentials' true'
Add_header Access-Control-Allow-Methods' GET, PUT, POST, DELETE, OPTIONS'; # support request method
Add_header Access-Control-Allow-Headers' Content-Type,*'
Root html/static
Index index.html index.htm
}
Error_page 500 502 503 504 / 50x.html
Location = / 50x.html {
Root html
}
Location ^ ~ / static/static/ {
Root html
}
}
}
4. Generate an image file
Docker build-t bms-nginx:0.0.1.
5. View the generated image
Docker images
6. Start mirroring
Docker run-d-name bms-nginx-p 80:80-network bms-nginx bms-nginx:0.0.1
These are all the contents of the article "how to deploy react front-end code to generate docker images through nginx based on centos". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.