From 872045acbfc5bae8d5c8c4d420baf65d287c3372 Mon Sep 17 00:00:00 2001 From: Yu Sun Date: Fri, 1 Jul 2022 21:51:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E4=BB=93=E5=BA=93?= =?UTF-8?q?=EF=BC=9B=E6=8F=90=E4=BE=9Bphp=E5=92=8Ctsdb=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 38 ++++++++++++++++++++++++++++++++++++++ REAMDE.md | 23 +++++++++++++++++++++++ composer.json | 13 +++++++++++++ docker-compose.yml | 17 +++++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 Dockerfile create mode 100644 REAMDE.md create mode 100644 composer.json create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7736b15 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +FROM ubuntu:22.04 + +ARG DEBIAN_FRONTEND=noninteractive +ENV TZ=Asia/Shanghai +# https://serverfault.com/a/683651 +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +RUN sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list \ + && apt update \ + && apt install -y software-properties-common \ + && add-apt-repository -y ppa:ondrej/php \ + && sed -i 's/ppa.launchpad.net/launchpad.proxy.ustclug.org/g' /etc/apt/sources.list.d/ondrej-ubuntu-php-jammy.list \ + && apt update \ + && apt install -y --no-install-recommends \ + make \ + curl \ + php \ + php-pear \ + php-dev \ + php-curl \ + php-xdebug \ + php-mbstring \ + php-xml \ + libevent-dev \ + && rm -rf /var/lib/apt/lists/* + +RUN printf "\n\n\n\n\nno\nyes\n\n" | pecl install event \ + && printf "; priority=30\nextension=event.so\n" > /etc/php/$(ls /etc/php/)/mods-available/event.ini \ + && phpenmod -v $(ls /etc/php/) event \ + && curl -s https://mirrors.aliyun.com/composer/composer.phar -o /usr/local/bin/composer \ + && chmod +x /usr/local/bin/composer \ + && composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ + +COPY . /SCADA + +WORKDIR /SCADA + +RUN composer install diff --git a/REAMDE.md b/REAMDE.md new file mode 100644 index 0000000..e1b05fa --- /dev/null +++ b/REAMDE.md @@ -0,0 +1,23 @@ +# SCADA + +## 开发环境 + +拉取代码: + +```bash +# 建议先配置SSH key pair +git clone ssh://git@118.195.187.246:10022/ysun/SCADA.git +cd SCADA +``` + +一键部署PHP workerman和TimescaleDB环境: + +```bash +docker compose up -d +``` + +进入交互式Prompt: + +```bash +docker exec -it scada bash +``` diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..35e8279 --- /dev/null +++ b/composer.json @@ -0,0 +1,13 @@ +{ + "require": { + "workerman/workerman": "^4.0", + }, + "require-dev": { + "codeception/codeception": "^4.1", + "codeception/module-phpbrowser": "^1.0.0", + "codeception/module-asserts": "^1.0.0", + "codeception/module-db": "^2.0", + "codeception/verify": "^2.2", + "symfony/var-dumper": "^5.4" + } +} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..bcc017b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +services: + scada: + container_name: scada + build: + context: . + network_mode: "host" + volumes: + - $PWD:/SCADA + restart: unless-stopped + + timescaledb: + container_name: tsdb + image: timescale/timescaledb-ha:pg14-latest + network_mode: "host" + restart: unless-stopped + environment: + POSTGRES_PASSWORD: big_dick