|
@@ -1,24 +1,27 @@
|
|
|
-FROM python:3.10-alpine
|
|
|
|
|
|
|
+FROM python:3.10-slim
|
|
|
|
|
|
|
|
-WORKDIR /root/workspace/
|
|
|
|
|
-COPY ./pyproject.toml ./
|
|
|
|
|
|
|
+ENV PYTHONUNBUFFERED=1 \
|
|
|
|
|
+ PYTHONDONTWRITEBYTECODE=1 \
|
|
|
|
|
+ PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/ \
|
|
|
|
|
+ PIP_TRUSTED_HOST=mirrors.aliyun.com \
|
|
|
|
|
+ POETRY_VERSION=1.8.4 \
|
|
|
|
|
+ POETRY_NO_INTERACTION=1 \
|
|
|
|
|
+ TZ=Asia/Shanghai
|
|
|
|
|
|
|
|
-RUN MAIN_VERSION=$(cat /etc/alpine-release | cut -d '.' -f 0-2) \
|
|
|
|
|
- && mv /etc/apk/repositories /etc/apk/repositories-bak \
|
|
|
|
|
- && { echo "https://mirrors.aliyun.com/alpine/v${MAIN_VERSION}/main"; \
|
|
|
|
|
- echo "https://mirrors.aliyun.com/alpine/v${MAIN_VERSION}/community"; } >> /etc/apk/repositories \
|
|
|
|
|
- && apk add --update --no-cache tzdata gcc build-base libffi-dev curl && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
|
|
|
|
- && mkdir ~/.pip \
|
|
|
|
|
- && printf '[global]\nindex-url=https://mirrors.aliyun.com/pypi/simple/' > ~/.pip/pip.conf \
|
|
|
|
|
- && python3 -m pip install --upgrade pip \
|
|
|
|
|
- && curl -o poetry-install.py -SL https://install.python-poetry.org \
|
|
|
|
|
- && python3 -u poetry-install.py \
|
|
|
|
|
- && rm poetry-install.py \
|
|
|
|
|
- && export PATH="/root/.local/bin:$PATH" \
|
|
|
|
|
- && poetry config virtualenvs.create false --local \
|
|
|
|
|
- && poetry install
|
|
|
|
|
|
|
+WORKDIR /root/workspace
|
|
|
|
|
|
|
|
-COPY . .
|
|
|
|
|
|
|
+RUN apt-get update \
|
|
|
|
|
+ && apt-get install -y --no-install-recommends tzdata \
|
|
|
|
|
+ && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
|
|
|
|
|
+ && echo $TZ > /etc/timezone \
|
|
|
|
|
+ && rm -rf /var/lib/apt/lists/* \
|
|
|
|
|
+ && python -m pip install --upgrade pip \
|
|
|
|
|
+ && pip install "poetry==$POETRY_VERSION" \
|
|
|
|
|
+ && poetry config virtualenvs.create false
|
|
|
|
|
+
|
|
|
|
|
+COPY pyproject.toml poetry.lock ./
|
|
|
|
|
+RUN poetry install --only main --no-root --no-ansi
|
|
|
|
|
|
|
|
|
|
+COPY . .
|
|
|
|
|
|
|
|
-CMD ["python", "-u", "main.py"]
|
|
|
|
|
|
|
+CMD ["python", "-u", "main.py"]
|