modified: Dockerfile

new file:   docker-compose.yml
	new file:   run_in_docker.md
This commit is contained in:
zhangyuheng 2023-12-04 10:59:32 +08:00
parent fb74b43d64
commit 0922d57976
3 changed files with 89 additions and 11 deletions

View File

@ -51,20 +51,17 @@ RUN composer dump-autoload -o --no-dev -n && \
resources/assets/ resources/misc resources/misc/backgrounds/ \
tools/ && \
mv .env.example .env && \
php artisan key:generate && \
mv .env storage/ && \
ln -s storage/.env .env && \
touch storage/database.db && \
mkdir storage/plugins && \
sed 's/PLUGINS_DIR=null/PLUGINS_DIR=\/app\/storage\/plugins/' -i storage/.env && \
sed 's/DB_CONNECTION=mysql/DB_CONNECTION=sqlite/' -i storage/.env && \
sed 's/DB_DATABASE=blessingskin/DB_DATABASE=\/app\/storage\/database\.db/' -i storage/.env
mkdir storage/plugins
FROM php:8-apache
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN apt update && apt install wget -y && cd /usr/local/bin && wget -c https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions
RUN chmod +x /usr/local/bin/install-php-extensions && \
export http_proxy=http://127.0.0.1:7890 && \
export https_proxy=http://127.0.0.1:7890 && \
install-php-extensions gd zip
WORKDIR /app
@ -76,7 +73,3 @@ RUN chown -R www-data:www-data . && \
sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf && \
sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf && \
a2enmod rewrite headers
EXPOSE 80
VOLUME ["/app/storage"]

21
docker-compose.yml Normal file
View File

@ -0,0 +1,21 @@
version: "3.7"
services:
blessing-skin:
image: blessing-skin:latest
container_name: blessing-skin
restart: always
ports:
- 8013:80
environment:
- TZ=Asia/Shanghai
volumes:
- blessing-skin-storage:/app/storage
volumes:
blessing-skin-storage:
name: blessing-skin-storage
driver: local
driver_opts:
o: bind
type: none
device: ./storage

64
run_in_docker.md Normal file
View File

@ -0,0 +1,64 @@
# 在容器中运行 Blessing Skin Server
## 1. 准备镜像
```
git clone https://ssl.lunadeer.cn:14446/zhangyuheng/blessing-skin-server.git
cd blessing-skin-server
docker build -t blessing-skin .
```
## 2. 初始化数据
```
cd /some/where/your/dir
mkdir blessing-skin
cd blessing-skin
mkdir storage
```
在 docker-compose.yml 文件中写入以下内容:
```
version: "3.7"
services:
blessing-skin:
image: blessing-skin:latest
container_name: blessing-skin
restart: always
ports:
- 8013:80
environment:
- TZ=Asia/Shanghai
volumes:
- blessing-skin-storage:/app/storage
volumes:
blessing-skin-storage:
name: blessing-skin-storage
driver: local
driver_opts:
o: bind
type: none
device: ./storage
```
运行一次容器生成配置数据,然后 control + c 退出:
```
docker compose up
```
## 3. 生成 APP_KEY
```
docker run --entrypoint="" --rm -it -v ./storage:/app/storage blessing-skin php artisan key:generate
```
## 4. 运行
```
docker compose up -d
```