Skip to content

Commit

Permalink
remove pdm.lock and mirror settings in Dockerfile (#195)
Browse files Browse the repository at this point in the history
create Dockerfile-cn for China users
  • Loading branch information
JaHIY authored Nov 22, 2023
1 parent 31ff695 commit bd08042
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
8 changes: 1 addition & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
FROM python:alpine

RUN sed -i 's|https://dl-cdn.alpinelinux.org|http://mirrors.tuna.tsinghua.edu.cn|g' /etc/apk/repositories

RUN apk add --no-cache gcc musl-dev python3-dev libffi-dev

RUN apk add --no-cache --virtual .build-app curl

RUN pip config set global.index-url 'https://mirrors.sustech.edu.cn/pypi/web/simple'

RUN curl -sSL https://pdm-project.org/install-pdm.py | python3 -

ENV PATH="/root/.local/bin:$PATH"

RUN pdm config pypi.url 'https://mirrors.sustech.edu.cn/pypi/web/simple'

WORKDIR /srv

COPY ./utils ./utils

COPY ./pyproject.toml ./pdm.lock ./miuitask.py ./
COPY ./pyproject.toml ./miuitask.py ./

RUN pdm install --prod

Expand Down
31 changes: 31 additions & 0 deletions Dockerfile-cn
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM python:alpine

RUN sed -i 's|https://dl-cdn.alpinelinux.org|http://mirrors.tuna.tsinghua.edu.cn|g' /etc/apk/repositories

RUN apk add --no-cache gcc musl-dev python3-dev libffi-dev

RUN apk add --no-cache --virtual .build-app curl

RUN pip config set global.index-url 'https://mirrors.sustech.edu.cn/pypi/web/simple'

RUN curl -sSL https://pdm-project.org/install-pdm.py | python3 -

ENV PATH="/root/.local/bin:$PATH"

RUN pdm config pypi.url 'https://mirrors.sustech.edu.cn/pypi/web/simple'

WORKDIR /srv

COPY ./utils ./utils

COPY ./pyproject.toml ./miuitask.py ./

RUN pdm install --prod

RUN { crontab -l; printf '%s\t%s\t%s\t%s\t%s\t%s\n' '0' '4' '*' '*' '*' '/usr/bin/env pdm run python /srv/miuitask.py'; } | crontab -

RUN apk del .build-app

VOLUME ["./data", "/srv/data"]

CMD ["/usr/sbin/crond", "-f"]

0 comments on commit bd08042

Please sign in to comment.