Compare commits
No commits in common. "71e542fb1f2c7e520a5d9a4a0b445c8e384db292" and "054a7e62dd7a235bbbb4800dce53965a8df80b5a" have entirely different histories.
71e542fb1f
...
054a7e62dd
19
Dockerfile
19
Dockerfile
|
|
@ -1,20 +1,17 @@
|
|||
# 使用 Python 映像檔
|
||||
# 使用輕量級的 Python 映像檔
|
||||
FROM python:3.11-slim
|
||||
|
||||
# 更新系統並安裝 FFmpeg
|
||||
RUN apt-get update && \
|
||||
apt-get install -y ffmpeg && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 設定工作目錄
|
||||
# 設定容器內的工作目錄
|
||||
WORKDIR /app
|
||||
|
||||
# 複製並安裝 Python 套件
|
||||
# 先複製需求文件,利用 Docker 快取機制加速打包
|
||||
COPY requirements.txt .
|
||||
|
||||
# 安裝必要的套件
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# 複製程式碼
|
||||
# 複製其餘的程式碼到容器內
|
||||
COPY . .
|
||||
|
||||
# 執行 Bot,加上 -u 確保輸出不被快取
|
||||
CMD ["python", "-u", "discord-bot.py"]
|
||||
# 執行你的 Discord Bot
|
||||
CMD ["python", "discord-bot.py"]
|
||||
|
|
@ -3,7 +3,6 @@ Base Cog - 基礎功能
|
|||
開發者:唐宋
|
||||
"""
|
||||
import discord
|
||||
import os
|
||||
from discord.ext import commands
|
||||
from discord import app_commands
|
||||
from dotenv import load_dotenv
|
||||
|
|
|
|||
|
|
@ -2,13 +2,9 @@ services:
|
|||
discord-bot:
|
||||
build: .
|
||||
container_name: my-discord-bot
|
||||
restart: always
|
||||
tty: true # 模擬終端機
|
||||
stdin_open: true # 開啟標準輸入
|
||||
environment:
|
||||
- PYTHONUNBUFFERED=1 # 強制 Python 立即輸出,不進行快取
|
||||
restart: always # 機器人當掉或伺服器重啟時會自動重啟
|
||||
env_file:
|
||||
- .env
|
||||
- .env # 讀取你的 .env 檔案(如果有的話)
|
||||
volumes:
|
||||
- .:/app # (選配) 開發階段可以掛載目錄,修改程式碼不用重新 build
|
||||
logging: # 限制日誌大小,避免硬碟被塞爆
|
||||
|
|
|
|||
Loading…
Reference in New Issue