Dockerfile 787 B

123456789101112131415161718192021222324252627
  1. FROM python:3.11-slim
  2. WORKDIR /app
  3. ENV PYTHONDONTWRITEBYTECODE=1
  4. ENV PYTHONUNBUFFERED=1
  5. ENV PIP_DISABLE_PIP_VERSION_CHECK=on
  6. ENV NVM_DIR=/root/.nvm
  7. ENV TZ=Asia/Shanghai
  8. # 安装 Node.js(推荐安装官方 LTS 版本)并安装 jsdom
  9. RUN apt-get update && apt-get install -y curl gnupg ca-certificates \
  10. && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
  11. && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
  12. && apt-get install -y nodejs \
  13. && npm install jsdom \
  14. && apt-get clean \
  15. && rm -rf /var/lib/apt/lists/*
  16. COPY requirements.txt .
  17. RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple
  18. COPY . .
  19. EXPOSE 6060
  20. CMD ["hypercorn", "task_app:app", "--config", "app_config.toml"]