diff --git a/.env b/.env.example similarity index 100% rename from .env rename to .env.example diff --git a/.gitignore b/.gitignore index a307e94f..74de06a2 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ node_modules .DS_Store dist *.local +.env # Editor directories and files .vscode/* diff --git a/Dockerfile b/Dockerfile index 399739b1..cf36fe8b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,10 +15,13 @@ FROM base AS builder RUN npm install -g pnpm WORKDIR /app -COPY package*json tsconfig.json pnpm-lock.yaml .env ./ +COPY package*json tsconfig.json pnpm-lock.yaml .env.example ./ COPY src ./src COPY public ./public +# add .env.example to .env +RUN [ ! -e ".env" ] && cp .env.example .env || true + RUN pnpm install RUN pnpm build RUN pnpm prune --production diff --git a/README.md b/README.md index b8d910fb..edc94f51 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,8 @@ cd DailyHotApi npm install ``` +复制 `/.env.example` 文件并重命名为 `/.env` 并修改配置 + #### 开发 ```bash