一、安装
1、创建docker-compose.yaml
bash
version: '3'
services:
snipeit:
container_name: snipeit
image: snipe/snipe-it:v6.1.2
restart: always
ports:
- "8000:80"
volumes:
- ./logs:/var/www/html/storage/logs
depends_on:
- mysql
env_file:
- .env.docker
networks:
- snipeit-backend
mysql:
image: mysql:5.7
container_name: snipeit-db
ports:
- 3308:3306
restart: always
volumes:
- ./data:/var/lib/mysql
env_file:
- .env.docker
networks:
- snipeit-backend
networks:
snipeit-backend:
2、下载docker环境配置文件:.env.docker,注意这是一个隐藏文件
下载地址:https://github.com/snipe/snipe-it/blob/v6.1.2/.env.docker
要修改的点如下:
MYSQL_PASSWORD,MYSQL_PASSWORD,APP_ENV,APP_KEY,APP_URL,APP_TIMEZONE,APP_LOCALE
用 "docker-compose run --rm snipeit bash" 生成 APP_KEY
bash
# --------------------------------------------
# REQUIRED: DB SETUP
# --------------------------------------------
MYSQL_DATABASE=snipeit
MYSQL_USER=snipeit
MYSQL_PASSWORD=123456
MYSQL_ROOT_PASSWORD=123456
# --------------------------------------------
# REQUIRED: BASIC APP SETTINGS
# --------------------------------------------
APP_ENV=production
APP_DEBUG=false
# please regenerate the APP_KEY value by calling `docker-compose run --rm snipeit bash` and then `php artisan key:generate --show` and then copy paste the value here
APP_KEY=base64:Re5HpqcZvAgRwxNJmW4FY2MVZgBTUpDOmBOE+96lTzE=
APP_URL=http://10.3.0.210:8000
APP_TIMEZONE='Asia/Shanghai'
APP_LOCALE=zh-CN
MAX_RESULTS=500
3、文件目录如下
[root@10-3-0-210 snipe-it]# ll -a
-rw-r--r-- 1 root root 556 Dec 3 00:41 docker-compose.yaml
-rw-r--r-- 1 root root 4557 Dec 3 00:45 .env.docker
4、运行
bash
[root@10-3-0-210 snipe-it]# docker-compose up -d
Creating network "snipe-it_snipeit-backend" with the default driver
Creating snipeit-db ... done
Creating snipeit ... done
二、设置
1、打开网址:http://10.3.0.210:8000/
2、修改权限
bash
docker exec -it snipeit /bin/bash
chmod -R 777 storage
3、 创建数据库,这一步超级慢,慢慢等吧
4、创建管理员
5、登录
6、首页
7、设置资产标签自动编号