chatgpt-telegram-bot
chatgpt-telegram-bot copied to clipboard
[Feature Request]: Docker config.json auto generate
Not a duplicate feature request
- [X] I have searched the existing issues and confirmed this feature request is not a duplicate.
Describe the feature
Please add something to auto generate the default.json file in a binded volume when the file doesn't exists, this is useful when you want to use the new file with new update features, and can save time by skipping the manual copy and paste from the repo
If I delete the previous generated file and update the container and try to run it gives this error because the file doesn't exists anymore
WARNING: To disable this warning set SUPPRESS_NO_CONFIG_WARNING in the environment.
Error: Configuration property "api.type" is not defined
at Config.get (/app/node_modules/.pnpm/[email protected]/node_modules/config/lib/config.js:179:11)
at loadConfig (file:///app/dist/utils.js:20:28)
at main (file:///app/dist/index.js:7:18)
at file:///app/dist/index.js:22:1
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
ELIFECYCLE Command failed with exit code 1.```
So maybe environment variables can be added to auto generate a new file after an update specifying API type and token
this probably is related to the Dockerfile config. Could you please try this dockerfile:
# Builder stage
FROM node:lts-alpine AS builder
RUN npm install -g pnpm
WORKDIR /app
COPY config /app/config
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile --ignore-scripts
COPY . .
RUN pnpm build
# Runner stage
FROM node:lts-alpine
RUN npm install -g pnpm
WORKDIR /app
COPY config /app/config
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile --ignore-scripts --prod --no-optional
COPY --from=builder /app/dist ./dist
CMD pnpm start