| FROM node:20-alpine | |
| WORKDIR /app | |
| # Install unzip utility | |
| RUN apk add --no-cache unzip | |
| # Copy and unzip the bot zip file to /app directly (flatten contents) | |
| COPY emperor-bot.zip ./ | |
| RUN unzip -q emperor-bot.zip -d temp \ | |
| && cp -r temp/*/* . \ | |
| && rm -rf temp emperor-bot.zip | |
| Run ls | |
| # Copy package.json and package-lock.json | |
| COPY package*.json ./ | |
| # Install TypeScript globally | |
| RUN npm install -g typescript | |
| # Install dependencies | |
| RUN npm install | |
| # Copy remaining source code | |
| COPY . . | |
| # Build TypeScript | |
| #RUN npm run build | |
| #Install dev dependencies required to run TypeScript directly | |
| RUN npm install --save-dev ts-node nodemon @types/node typescript | |
| # Expose port | |
| EXPOSE 7860 | |
| # Start the bot | |
| CMD ["npm", "run", "dev"] | |