Compare commits

..

No commits in common. "71e542fb1f2c7e520a5d9a4a0b445c8e384db292" and "054a7e62dd7a235bbbb4800dce53965a8df80b5a" have entirely different histories.

3 changed files with 10 additions and 18 deletions

View File

@ -1,20 +1,17 @@
# 使用 Python 映像檔 # 使用輕量級的 Python 映像檔
FROM python:3.11-slim FROM python:3.11-slim
# 更新系統並安裝 FFmpeg # 設定容器內的工作目錄
RUN apt-get update && \
apt-get install -y ffmpeg && \
rm -rf /var/lib/apt/lists/*
# 設定工作目錄
WORKDIR /app WORKDIR /app
# 複製並安裝 Python 套件 # 先複製需求文件,利用 Docker 快取機制加速打包
COPY requirements.txt . COPY requirements.txt .
# 安裝必要的套件
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
# 複製程式碼 # 複製其餘的程式碼到容器內
COPY . . COPY . .
# 執行 Bot,加上 -u 確保輸出不被快取 # 執行你的 Discord Bot
CMD ["python", "-u", "discord-bot.py"] CMD ["python", "discord-bot.py"]

View File

@ -3,7 +3,6 @@ Base Cog - 基礎功能
開發者唐宋 開發者唐宋
""" """
import discord import discord
import os
from discord.ext import commands from discord.ext import commands
from discord import app_commands from discord import app_commands
from dotenv import load_dotenv from dotenv import load_dotenv

View File

@ -2,13 +2,9 @@ services:
discord-bot: discord-bot:
build: . build: .
container_name: my-discord-bot container_name: my-discord-bot
restart: always restart: always # 機器人當掉或伺服器重啟時會自動重啟
tty: true # 模擬終端機
stdin_open: true # 開啟標準輸入
environment:
- PYTHONUNBUFFERED=1 # 強制 Python 立即輸出,不進行快取
env_file: env_file:
- .env - .env # 讀取你的 .env 檔案(如果有的話)
volumes: volumes:
- .:/app # (選配) 開發階段可以掛載目錄,修改程式碼不用重新 build - .:/app # (選配) 開發階段可以掛載目錄,修改程式碼不用重新 build
logging: # 限制日誌大小,避免硬碟被塞爆 logging: # 限制日誌大小,避免硬碟被塞爆