docker-compose config

update readme
update some file
This commit is contained in:
SimpleYoungMan 2019-10-29 11:03:46 +08:00
parent 710f454122
commit 3bc8f58a1b
7 changed files with 75 additions and 8 deletions

View File

@ -7,9 +7,9 @@ APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_HOST=db
DB_PORT=3306
DB_DATABASE=laravel
DB_DATABASE=v2board
DB_USERNAME=root
DB_PASSWORD=

4
.gitignore vendored
View File

@ -7,7 +7,11 @@
.env
.env.backup
.phpunit.result.cache
.idea
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
composer.phar
yarn.lock
dbdata

24
docker-compose.yml Normal file
View File

@ -0,0 +1,24 @@
version: '3'
services:
db:
container_name: v2board-db
image: mysql
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=true
volumes:
- ./dbdata:/var/lib/mysql
- ./install.sql:/install.sql
backend:
image: composer
working_dir: /root/backend
volumes:
- .:/root/backend
nginx:
image: nginx
volumes:
- .:/root/backend
- ./nginx:/etc/nginx/conf.d
ports:
- 8964:80

View File

@ -1,4 +1,2 @@
wget https://getcomposer.org/download/1.9.0/composer.phar
php composer install
php artisan key:generate
php artisan config:cache

View File

@ -2,6 +2,9 @@ SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP DATABASE IF EXISTS `v2board`;
CREATE DATABASE `v2board`;
USE `v2board`;
DROP TABLE IF EXISTS `v2_invite_code`;
CREATE TABLE `v2_invite_code` (

3
nginx/backend.conf Normal file
View File

@ -0,0 +1,3 @@
server {
}

View File

@ -1 +1,36 @@
sh init.sh
## Environment:
- PHP7.3+
- composer
- MySQL5.5+
## Steps
### Before
执行 `cp .env.example .env` 然后配置它;
### 本地环境部署
1. 下载 composer
> ```shell script
> wget https://getcomposer.org/download/1.9.0/composer.phar
> php composer.phar install
> ```
2. 初始化项目
> ```shell script
> sh init.sh
> ```
>
3. 从 `install.sql` 文件中恢复表
### Docker 环境部署
1. 初始化项目
> ```shell script
> docker-compose run --rm backend composer install
> docker-compose run --rm backend sh init.sh
> ```
2. 进入 docker 容器从 `install.sql` 文件中恢复表
3. 执行 `docker-compose up -d` 启动服务