modify the Dockerfile
parent
e2d7db0d8d
commit
24204896df
|
@ -70,6 +70,11 @@ MyEMS项目由下列组件构成:
|
|||
### Docker Docker-compose 安装
|
||||
```
|
||||
git clone https://gitee.com/myems/myems.git
|
||||
|
||||
# for generate the static direction: 'build'
|
||||
cd myems/web
|
||||
npm run build
|
||||
|
||||
cd myems
|
||||
docker-compose up -d
|
||||
```
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
FROM nginx
|
||||
|
||||
# remove the config
|
||||
RUN rm /etc/nginx/conf.d/default.conf && \
|
||||
rm /etc/nginx/nginx.conf && \
|
||||
mkdir -p /usr/share/nginx/web && \
|
||||
mkdir -p /usr/share/nginx/admin
|
||||
|
||||
# copy the config and web codes
|
||||
COPY ./nginx.conf /etc/nginx/
|
||||
COPY ./web/build/ /usr/share/nginx/web
|
||||
COPY ./admin/ /usr/share/nginx/admin
|
||||
CMD ['nginx', '-c /etc/nginx/nginx.conf', '-g "daemon off;"']
|
|
@ -1,5 +1,11 @@
|
|||
FROM nginx
|
||||
WORKDIR /code
|
||||
|
||||
COPY . /usr/share/nginx/html
|
||||
# remove the config
|
||||
RUN rm /etc/nginx/conf.d/default.conf && \
|
||||
rm /etc/nginx/nginx.conf && \
|
||||
mkdir -p /usr/share/nginx/admin
|
||||
|
||||
# copy the config and web codes
|
||||
COPY nginx.conf /etc/nginx/
|
||||
COPY . /usr/share/nginx/admin
|
||||
CMD ['nginx', '-c /etc/nginx/nginx.conf', '-g "daemon off;"']
|
|
@ -0,0 +1,57 @@
|
|||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
error_log /var/log/nginx/error.log notice;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
server {
|
||||
listen 8001;
|
||||
server_name localhost;
|
||||
|
||||
#access_log /var/log/nginx/host.access.log main;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/admin;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
#error_page 404 /404.html;
|
||||
|
||||
# redirect server error pages to the static page /50x.html
|
||||
#
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://127.0.0.1:8000/;
|
||||
proxy_connect_timeout 75;
|
||||
proxy_read_timeout 600;
|
||||
send_timeout 600;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -32,23 +32,18 @@ services:
|
|||
network_mode: "host"
|
||||
restart: always
|
||||
|
||||
web-docker:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Web-Dockerfile
|
||||
admin:
|
||||
build: ./admin
|
||||
command: nginx -c /etc/nginx/nginx.conf -g "daemon off;"
|
||||
healthcheck:
|
||||
test: [ "CMD","nginx","-t" ]
|
||||
network_mode: "host"
|
||||
restart: always
|
||||
|
||||
# web:
|
||||
# build: ./web
|
||||
# command: nginx -c /etc/nginx/nginx.conf -g "daemon off;"
|
||||
# healthcheck:
|
||||
# test: [ "CMD","nginx","-t" ]
|
||||
# network_mode: "host"
|
||||
# restart: always
|
||||
# ports:
|
||||
# - "10001:80"
|
||||
|
||||
web:
|
||||
build: ./web
|
||||
command: nginx -c /etc/nginx/nginx.conf -g "daemon off;"
|
||||
healthcheck:
|
||||
test: [ "CMD","nginx","-t" ]
|
||||
network_mode: "host"
|
||||
restart: always
|
|
@ -1,5 +1,13 @@
|
|||
FROM nginx
|
||||
WORKDIR /code
|
||||
|
||||
COPY ./build/ /usr/share/nginx/html
|
||||
#CMD ['nginx', '-c /etc/nginx/nginx.conf', '-g "daemon off;"']
|
||||
# remove the config
|
||||
RUN rm /etc/nginx/conf.d/default.conf && \
|
||||
rm /etc/nginx/nginx.conf && \
|
||||
mkdir -p /usr/share/nginx/web
|
||||
|
||||
# copy the config and web codes
|
||||
# Attention:
|
||||
# You should run 'npm run build' in the web direction to generate the build direction because this's a react projection.
|
||||
COPY nginx.conf /etc/nginx/
|
||||
COPY . /usr/share/nginx/web
|
||||
CMD ['nginx', '-c /etc/nginx/nginx.conf', '-g "daemon off;"']
|
|
@ -0,0 +1,56 @@
|
|||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
error_log /var/log/nginx/error.log notice;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
#access_log /var/log/nginx/host.access.log main;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/web;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
#error_page 404 /404.html;
|
||||
|
||||
# redirect server error pages to the static page /50x.html
|
||||
#
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://127.0.0.1:8000/;
|
||||
proxy_connect_timeout 75;
|
||||
proxy_read_timeout 600;
|
||||
send_timeout 600;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue