added nano to Dockfile

pull/139/head
13621160019@163.com 2022-04-04 17:53:44 +08:00
parent 9e1c35bcb4
commit a1e894cf5f
14 changed files with 94 additions and 46 deletions

View File

@ -1,5 +1,7 @@
FROM nginx:latest FROM nginx:latest
RUN apt update && apt install -y nano
# remove the default config # remove the default config
RUN rm /etc/nginx/conf.d/default.conf && \ RUN rm /etc/nginx/conf.d/default.conf && \
rm /etc/nginx/nginx.conf rm /etc/nginx/nginx.conf

View File

@ -3,6 +3,7 @@
## Introduction ## Introduction
系统管理用户界面用于MyEMS系统配置 系统管理用户界面用于MyEMS系统配置
Admin UI for MyEMS system settings Admin UI for MyEMS system settings
## Prerequisites ## Prerequisites
@ -16,9 +17,22 @@ nginx-1.18.0 or later
In this section, you will install myems-admin on Docker. In this section, you will install myems-admin on Docker.
* replace ~~127.0.0.1:8000~~ in nginx.conf with actual **HOST** ip and port of myems-api * Copy source code to root directory
On Windows:
```bash
cp -r myems/myems-admin c:\
cd c:\myems-admin
```
On Linux:
```bash
cp -r myems/myems-admin /
cd /myems-admin
```
* Manually replace ~~127.0.0.1:8000~~ in nginx.conf with actual **HOST** ip and port of myems-api
```bash ```bash
cd myems/myems-admin
nano nginx.conf nano nginx.conf
``` ```
@ -28,17 +42,7 @@ nano nginx.conf
* Build a Docker image * Build a Docker image
On Windows:
```bash ```bash
cp -r myems/myems-admin c:\myems-admin
cd c:\myems-admin
docker build -t myems/myems-admin .
```
On Linux:
```bash
cp -r myems/myems-admin /myems-admin
cd /myems-admin
docker build -t myems/myems-admin . docker build -t myems/myems-admin .
``` ```
@ -49,6 +53,7 @@ If run on Windows host, bind-mount a share upload file folder at c:\myems-upload
```bash ```bash
docker run -d -p 8001:8001 -v c:\myems-upload:/var/www/myems-admin/upload -v c:\myems-admin/nginx.conf:/etc/nginx/nginx.conf:ro --restart always --name myems-admin myems/myems-admin docker run -d -p 8001:8001 -v c:\myems-upload:/var/www/myems-admin/upload -v c:\myems-admin/nginx.conf:/etc/nginx/nginx.conf:ro --restart always --name myems-admin myems/myems-admin
``` ```
If run on Linux host, bind-mount a share upload file folder at /myems-upload to the container and also bind-mount nginx.conf If run on Linux host, bind-mount a share upload file folder at /myems-upload to the container and also bind-mount nginx.conf
```bash ```bash
docker run -d -p 8001:8001 -v /myems-upload:/var/www/myems-admin/upload -v /myems-admin/nginx.conf:/etc/nginx/nginx.conf:ro --restart always --name myems-admin myems/myems-admin docker run -d -p 8001:8001 -v /myems-upload:/var/www/myems-admin/upload -v /myems-admin/nginx.conf:/etc/nginx/nginx.conf:ro --restart always --name myems-admin myems/myems-admin
@ -72,6 +77,7 @@ If you want to immigrate the image to another computer,
```bash ```bash
docker save --output myems-admin.tar myems/myems-admin docker save --output myems-admin.tar myems/myems-admin
``` ```
* Copy the tarball file to another computer, and then load image from tarball file * Copy the tarball file to another computer, and then load image from tarball file
```bash ```bash
docker load --input .\myems-admin.tar docker load --input .\myems-admin.tar

View File

@ -1,6 +1,8 @@
FROM python:slim FROM python:slim
WORKDIR /code
RUN apt update && apt install -y nano
WORKDIR /code
COPY . /code COPY . /code
RUN pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com RUN pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
CMD ["python", "main.py"] CMD ["python", "main.py"]

View File

@ -6,7 +6,7 @@ Data Aggregation Service
## Introduction ## Introduction
This service is a component of MyEMS. It aggregates normalized data up to multiple dimensions. This service is a component of MyEMS to aggregate normalized data up to multiple dimensions.
## Prerequisites ## Prerequisites
@ -45,22 +45,27 @@ cp -r myems/myems-aggregation /
cd /myems/myems-aggregation cd /myems/myems-aggregation
``` ```
* Duplicate example.env file as .env file and modify the .env file * Create .env file based on example.env file
Replace ~~127.0.0.1~~ with real **HOST** IP address.
Manually replace ~~127.0.0.1~~ with real **HOST** IP address.
```bash ```bash
cp example.env .env cp example.env .env
``` ```
* Build a Docker image * Build a Docker image
*
```bash ```bash
docker build -t myems/myems-aggregation . docker build -t myems/myems-aggregation .
``` ```
* Run a Docker container * Run a Docker container
On Windows host, bind-mount the .env to the container: On Windows host, bind-mount the .env to the container:
```bash ```bash
docker run -d -v c:\myems-aggregation\.env:/code/.env:ro --restart always --name myems-aggregation myems/myems-aggregation docker run -d -v c:\myems-aggregation\.env:/code/.env:ro --restart always --name myems-aggregation myems/myems-aggregation
``` ```
On Linux host, bind-mount the .env to the container: On Linux host, bind-mount the .env to the container:
```bash ```bash
docker run -d -v /myems-aggregation/.env:/code/.env:ro --restart always --name myems-aggregation myems/myems-aggregation docker run -d -v /myems-aggregation/.env:/code/.env:ro --restart always --name myems-aggregation myems/myems-aggregation

View File

@ -1,9 +1,11 @@
FROM python:slim FROM python:slim
WORKDIR /code
# RUN apt update && apt install -y nano
# todo: share upload folder with admin container on Docker # todo: share upload folder with admin container on Docker
RUN mkdir -p /var/www/myems-admin/upload RUN mkdir -p /var/www/myems-admin/upload
WORKDIR /code
COPY . /code COPY . /code
RUN pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com RUN pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
EXPOSE 8000 EXPOSE 8000

View File

@ -69,25 +69,31 @@ waitress-serve --listen=127.0.0.1:8000 app:api
In this section, you will install myems-api on Docker. In this section, you will install myems-api on Docker.
* Duplicate example.env file as .env file and modify the .env file * Copy source code to root directory
Replace ~~127.0.0.1~~ with real **HOST** IP address.
```bash
cp example.env .env
```
* Build a Docker image
On Windows: On Windows:
```bash ```bash
cp -r myems/myems-api c:\ cp -r myems/myems-api c:\
cd c:\myems-api cd c:\myems-api
docker build -t myems/myems-api .
``` ```
On Linux: On Linux:
```bash ```bash
cp -r myems/myems-api / cp -r myems/myems-api /
cd /myems-api cd /myems-api
```
* Create .env file based on example.env file
Manually replace ~~127.0.0.1~~ with real **HOST** IP address.
```bash
cp example.env .env
```
* Build a Docker image
```bash
docker build -t myems/myems-api . docker build -t myems/myems-api .
``` ```

View File

@ -1,6 +1,8 @@
FROM python:slim FROM python:slim
WORKDIR /code
RUN apt update && apt install -y nano
WORKDIR /code
COPY . /code COPY . /code
RUN pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com RUN pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
CMD ["python", "main.py"] CMD ["python", "main.py"]

View File

@ -1,11 +1,12 @@
# myems-cleaning # myems-cleaning
MyEMS Cleaning Service MyEMS Cleaning Service
MyEMS 数据清洗服务 MyEMS 数据清洗服务
## Introduction ## Introduction
This service is a component of MyEMS. It cleans the historical data. This service is a component of MyEMS to clean the historical data.
## Prerequisites ## Prerequisites
@ -44,8 +45,10 @@ cp -r myems/myems-cleaning /
cd /myems-cleaning cd /myems-cleaning
``` ```
* Duplicate example.env file as .env file and modify the .env file * Create .env file based on example.env file
Replace ~~127.0.0.1~~ with real **HOST** IP address.
Manually replace ~~127.0.0.1~~ with real **HOST** IP address.
```bash ```bash
cp example.env .env cp example.env .env
``` ```
@ -54,16 +57,19 @@ cp example.env .env
```bash ```bash
docker build -t myems/myems-cleaning . docker build -t myems/myems-cleaning .
``` ```
* Run a Docker container * Run a Docker container
On Windows host, bind-mount the .env to the container: On Windows host, bind-mount the .env to the container:
```bash ```bash
docker run -d -v c:\myems-cleaning\.env:/code/.env:ro --restart always --name myems-cleaning myems/myems-cleaning docker run -d -v c:\myems-cleaning\.env:/code/.env:ro --restart always --name myems-cleaning myems/myems-cleaning
``` ```
On Linux host, bind-mount the .env to the container: On Linux host, bind-mount the .env to the container:
```bash ```bash
docker run -d -v /myems-cleaning/.env:/code/.env:ro --restart always --name myems-cleaning myems/myems-cleaning docker run -d -v /myems-cleaning/.env:/code/.env:ro --restart always --name myems-cleaning myems/myems-cleaning
``` ```
* -d Run container in background and print container ID * -d Run container in background and print container ID
* -v If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host, * -v If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host,

View File

@ -1,6 +1,8 @@
FROM python:slim FROM python:slim
WORKDIR /code
RUN apt update && apt install -y nano
WORKDIR /code
COPY . /code COPY . /code
RUN pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com RUN pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
CMD ["python", "main.py"] CMD ["python", "main.py"]

View File

@ -2,7 +2,7 @@
### Introduction ### Introduction
This service is a component of MyEMS Community Edition to acquire data from Modbus TCP devices. This service is a component of MyEMS to acquire data from Modbus TCP devices.
### Prerequisites ### Prerequisites
@ -45,8 +45,10 @@ cp -r myems/myems-modbus-tcp /
cd /myems-modbus-tcp cd /myems-modbus-tcp
``` ```
* Duplicate example.env file as .env file and modify the .env file * Create .env file based on example.env file
Replace ~~127.0.0.1~~ with real **HOST** IP address.
Manually replace ~~127.0.0.1~~ with real **HOST** IP address.
```bash ```bash
cp example.env .env cp example.env .env
``` ```
@ -55,16 +57,19 @@ cp example.env .env
```bash ```bash
docker build -t myems/myems-modbus-tcp . docker build -t myems/myems-modbus-tcp .
``` ```
* Run a Docker container * Run a Docker container
On Windows host, bind-mount the .env to the container: On Windows host, bind-mount the .env to the container:
```bash ```bash
docker run -d -v c:\myems-modbus-tcp\.env:/code/.env:ro --restart always --name myems-modbus-tcp myems/myems-modbus-tcp docker run -d -v c:\myems-modbus-tcp\.env:/code/.env:ro --restart always --name myems-modbus-tcp myems/myems-modbus-tcp
``` ```
On Linux host, bind-mount the .env to the container: On Linux host, bind-mount the .env to the container:
```bash ```bash
docker run -d -v /myems-modbus-tcp/.env:/code/.env:ro --restart always --name myems-modbus-tcp myems/myems-modbus-tcp docker run -d -v /myems-modbus-tcp/.env:/code/.env:ro --restart always --name myems-modbus-tcp myems/myems-modbus-tcp
``` ```
* -d Run container in background and print container ID * -d Run container in background and print container ID
* -v If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host, * -v If you use -v or --volume to bind-mount a file or directory that does not yet exist on the Docker host,

View File

@ -1,6 +1,8 @@
FROM python:slim FROM python:slim
WORKDIR /code
RUN apt update && apt install -y nano
WORKDIR /code
COPY . /code COPY . /code
RUN pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com RUN pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
CMD ["python", "main.py"] CMD ["python", "main.py"]

View File

@ -6,7 +6,7 @@ MyEMS Normalization Service
## Introduction ## Introduction
This service is a component of MyEMS. It normalizes energy data in historical database. This service is a component of MyEMS to normalize energy data in historical database.
![MyEMS Meter Normalization](../docs/images/meter-normalization.png) ![MyEMS Meter Normalization](../docs/images/meter-normalization.png)
@ -51,10 +51,10 @@ cp -r myems/myems-normalization /
cd /myems-normalization cd /myems-normalization
``` ```
* Create .env file * Create .env file based on example.env file
Manually replace ~~127.0.0.1~~ with real **HOST** IP address.
Duplicate example.env file as .env file and modify the .env file
Replace ~~127.0.0.1~~ with real **HOST** IP address.
```bash ```bash
cp example.env .env cp example.env .env
``` ```
@ -63,6 +63,7 @@ cp example.env .env
```bash ```bash
docker build -t myems/myems-normalization . docker build -t myems/myems-normalization .
``` ```
* Run a Docker container * Run a Docker container
On Windows host, bind-mount the .env to the container: On Windows host, bind-mount the .env to the container:

View File

@ -1,4 +1,4 @@
FROM node:latest as build-stage FROM node:latest as build-stage
WORKDIR /opt WORKDIR /opt
COPY . . COPY . .
RUN npm install --registry https://registry.npm.taobao.org RUN npm install --registry https://registry.npm.taobao.org
@ -7,14 +7,14 @@ RUN npm run build
FROM nginx:latest as production-stage FROM nginx:latest as production-stage
RUN apt update && apt install -y nano
# remove the default config # remove the default config
RUN rm /etc/nginx/conf.d/default.conf && rm /etc/nginx/nginx.conf RUN rm /etc/nginx/conf.d/default.conf && rm /etc/nginx/nginx.conf
# create new root folder # create new root folder
RUN mkdir -p /var/www/myems-web RUN mkdir -p /var/www/myems-web
# Note: You should run 'npm run build' in the web direction to generate the production build.
COPY nginx.conf /etc/nginx/ COPY nginx.conf /etc/nginx/
COPY --from=build-stage /opt/build/ /var/www/myems-web COPY --from=build-stage /opt/build/ /var/www/myems-web
EXPOSE 80 EXPOSE 80

View File

@ -3,6 +3,7 @@
## Introduction ## Introduction
Web用户界面用于MyEMS能源数据可视化 Web用户界面用于MyEMS能源数据可视化
Web UI for MyEMS energy data visualization Web UI for MyEMS energy data visualization
## Prerequisites ## Prerequisites
@ -72,21 +73,26 @@ cd myems/myems-web
nano nginx.conf nano nginx.conf
``` ```
* Build a Docker image
**NOTE**: You can safely ignore the command 'npm run build' in this section, because it is built into the Dockerfile * Copy source code to root directory
On Windows: On Windows:
```bash ```bash
cp -r myems/myems-web c:\myems-web cp -r myems/myems-web c:\
cd c:\myems-web cd c:\myems-web
docker build -t myems/myems-web .
``` ```
On Linux: On Linux:
```bash ```bash
cp -r myems/myems-web /myems-web cp -r myems/myems-web /
cd /myems-web cd /myems-web
```
**NOTE**: You can safely ignore the command 'npm run build' in this section, because it is built into the Dockerfile
* Build a Docker image
```bash
docker build -t myems/myems-web . docker build -t myems/myems-web .
``` ```
@ -119,6 +125,7 @@ If you want to immigrate the image to another computer,
```bash ```bash
docker save --output myems-web.tar myems/myems-web docker save --output myems-web.tar myems/myems-web
``` ```
* Copy the tarball file to another computer, and then load image from tarball file * Copy the tarball file to another computer, and then load image from tarball file
```bash ```bash
docker load --input .\myems-web.tar docker load --input .\myems-web.tar