This commit is contained in:
2025-04-15 00:28:15 +08:00
parent 0f3bdb249e
commit e4cee31543
5 changed files with 5 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
## esm.sh docker
```sh
docker pull ghcr.io/esm-dev/esm.sh
```
```sh
docker pull m.daocloud.io/ghcr.io/esm-dev/esm.sh
```
## 部署配置
`config.json`
```json
{
"port": 8080,
"npmRegistry": "https://registry.npmjs.org/"
}
```
`compose.yml`
```yml
version: '3'
services:
esm:
image: ghcr.io/esm-dev/esm.sh:latest
container_name: esm
ports:
- '12000:8080'
environment:
- LOG_LEVEL=debug
volumes:
- ./config.json:/esmd/config.json
- ./data:/esmd
```
## 介绍
Available environment variables:
COMPRESS使用gzip/brotli压缩HTTP响应默认值为true启用
CUSTOM_LANDING_PAGE_ORIGIN自定义着陆页来源地址默认为空。
CUSTOM_LANDING_PAGE_ASSETS自定义着陆页资源文件以逗号分隔默认为空。
CORS_ALLOW_ORIGINS允许的CORS来源以逗号分隔默认允许所有来源*)。
LOG_LEVEL日志级别可选值["debug", "info", "warn", "error"],默认为"info"。
ACCESS_LOG是否启用访问日志默认false禁用
MINIFY是否压缩构建后的JS/CSS文件默认true启用
NPM_QUERY_CACHE_TTLNPM查询缓存有效期默认10分钟。
NPM_REGISTRY全局NPM镜像源默认为"https://registry.npmjs.org/"。
NPM_TOKEN全局NPM镜像源的访问令牌。
NPM_USER全局NPM镜像源的访问用户名。
NPM_PASSWORD全局NPM镜像源的访问密码。
SOURCEMAP是否为构建的JS/CSS文件生成源码映射默认true启用
STORAGE_TYPE存储类型可选值["fs", "s3"],默认为"fs"(本地文件系统)。
STORAGE_ENDPOINT存储服务端点默认路径为"~/.esmd/storage"。
STORAGE_REGIONS3存储区域仅S3存储需要
STORAGE_ACCESS_KEY_IDS3存储的访问密钥ID。
STORAGE_SECRET_ACCESS_KEYS3存储的私有访问密钥。
You can also create your own Dockerfile based on ghcr.io/esm-dev/esm.sh:
FROM ghcr.io/esm-dev/esm.sh:latest
ADD --chown=esm:esm ./config.json /etc/esmd/config.json
CMD ["esmd", "--config", "/etc/esmd/config.json"]