From 35d9ea4a026ea268449a153dafea3bf6a00fc1de Mon Sep 17 00:00:00 2001 From: hyh123a Date: Thu, 5 Aug 2021 10:35:15 +0800 Subject: [PATCH] modify the Dockerfile --- admin/Dockerfile | 1 + docker-compose.yml | 16 +++++++--------- myems-api/Dockerfile | 1 + web/Dockerfile | 1 + 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/admin/Dockerfile b/admin/Dockerfile index 8b3d2691..0b0cd92d 100644 --- a/admin/Dockerfile +++ b/admin/Dockerfile @@ -8,4 +8,5 @@ RUN rm /etc/nginx/conf.d/default.conf && \ # copy the config and web codes COPY nginx.conf /etc/nginx/ COPY . /usr/share/nginx/admin +EXPOSE 8001 CMD ['nginx', '-c /etc/nginx/nginx.conf', '-g "daemon off;"'] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 18fb4554..243f0789 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,31 +3,28 @@ services: api: build: ./myems-api command: gunicorn app:api -b 0.0.0.0:8000 - network_mode: "host" restart: always + ports: + - "8000:8000" aggregation: build: ./myems-aggregation command: python main.py - network_mode: "host" restart: always cleaning: build: ./myems-cleaning command: python main.py - network_mode: "host" restart: always modbus_tcp: build: ./myems-modbus-tcp command: python main.py - network_mode: "host" restart: always normalization: build: ./myems-normalization command: python main.py - network_mode: "host" restart: always admin: @@ -35,13 +32,14 @@ services: command: nginx -c /etc/nginx/nginx.conf -g "daemon off;" healthcheck: test: [ "CMD","nginx","-t" ] - network_mode: "host" restart: always - + ports: + - "8001:8001" web: build: ./web command: nginx -c /etc/nginx/nginx.conf -g "daemon off;" healthcheck: test: [ "CMD","nginx","-t" ] - network_mode: "host" - restart: always \ No newline at end of file + restart: always + ports: + - "80:80" \ No newline at end of file diff --git a/myems-api/Dockerfile b/myems-api/Dockerfile index 05f44852..ef1da61d 100644 --- a/myems-api/Dockerfile +++ b/myems-api/Dockerfile @@ -3,4 +3,5 @@ WORKDIR /code COPY . /code RUN pip install -r requirements.txt +EXPOSE 8000 CMD ['gunicorn', 'app:api', '-b 0.0.0.0:8000'] \ No newline at end of file diff --git a/web/Dockerfile b/web/Dockerfile index 41d7d2c8..24bc82a1 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -10,4 +10,5 @@ RUN rm /etc/nginx/conf.d/default.conf && \ # 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 +EXPOSE 80 CMD ['nginx', '-c /etc/nginx/nginx.conf', '-g "daemon off;"'] \ No newline at end of file