# docker-compose.yml
version: '2'
services:
web:
image: gitea/gitea:1.11.0
volumes:
- ./data:/data
- /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime
ports:
- "8360:8360"
- "8361:8361"
depends_on:
- db
db:
image: mariadb:10
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=gitea
- MYSQL_USER=gitea
- MYSQL_PASSWORD=gitea
ports:
- "9306:3306"
volumes:
- ./db/:/var/lib/mysql
# 版本发布时上传文件
两个问题:
- 上传文件的大小
- 上传文件的类型
在app.ini中定义
[attachment]
; Whether to enabled upload attachments in general.
ENABLED = true
; The path to store attachments on the file system.
PATH = data/attachments
; File types that are allowed to be uploaded, e.g. "image/jpeg|image/png". Leave empty to allow any file type.
ALLOWED_TYPES = image/jpeg|image/png
; The maximum size of each file in MB.
MAX_SIZE = 4
; The maximum number of files per upload.
MAX_FILES = 5
默认是4MB ==> 100
ALLOWED_TYPES根据注释是留空就为任意类型,其实不然.
这里的类型一定要是 MIME 类型.
文件类型和MIME类型的对照关系可以参照 https://www.w3school.com.cn/media/media_mimeref.asp (opens new window)
修改后:
ALLOWED_TYPES = */*
MAX_SIZE = 100