Dockerfile 1.0 KB

123456789101112131415161718192021222324
  1. FROM python:3.10-alpine
  2. WORKDIR /root/workspace/
  3. COPY ./pyproject.toml ./
  4. RUN MAIN_VERSION=$(cat /etc/alpine-release | cut -d '.' -f 0-2) \
  5. && mv /etc/apk/repositories /etc/apk/repositories-bak \
  6. && { echo "https://mirrors.aliyun.com/alpine/v${MAIN_VERSION}/main"; \
  7. echo "https://mirrors.aliyun.com/alpine/v${MAIN_VERSION}/community"; } >> /etc/apk/repositories \
  8. && apk add --update --no-cache tzdata gcc build-base libffi-dev curl && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
  9. && mkdir ~/.pip \
  10. && printf '[global]\nindex-url=https://mirrors.aliyun.com/pypi/simple/' > ~/.pip/pip.conf \
  11. && python3 -m pip install --upgrade pip \
  12. && curl -o poetry-install.py -SL https://install.python-poetry.org \
  13. && python3 -u poetry-install.py \
  14. && rm poetry-install.py \
  15. && export PATH="/root/.local/bin:$PATH" \
  16. && poetry config virtualenvs.create false --local \
  17. && poetry install
  18. COPY . .
  19. CMD ["python", "-u", "main.py"]