Skip to content

Commit

Permalink
update(Docker):镜像分层
Browse files Browse the repository at this point in the history
  • Loading branch information
Akimio521 committed Jun 13, 2024
1 parent 9b84f68 commit d2bd345
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
36 changes: 18 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@ FROM python:3.11-alpine
ENV INTERVAL=3600 \
TZ=Asia/Shanghai

WORKDIR "/app"
COPY entrypoint.sh entrypoint.sh

RUN sed -i 's/\r//' entrypoint.sh \
&& chmod +x entrypoint.sh

COPY . .
RUN apk update \
&& apk upgrade \
&& apk add bash \
&& pip install --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt \
&& rm -rf \
./config/* \
./.github \
.git \
./.gitignore \
./Dockerfile \
./README.md \
./requirements.txt \
./LICENSE \
/tep/* \
/var/lib/apt/lists/* \
/var/tmp/* \
&& chmod +x entrypoint.sh \
&& sed -i 's/\r//' entrypoint.sh
/tep \
/var/lib/apt/lists \
/var/tmp

COPY requirements.txt requirements.txt

RUN pip install --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt \
&& rm -rf requirements.txt

WORKDIR "/app"

COPY main.py autofilm.py version.py /app/

VOLUME ["/app/config", "/app/media"]
ENTRYPOINT ["/app/entrypoint.sh"]
ENTRYPOINT ["/entrypoint.sh"]
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if [[ "$INTERVAL" -eq 0 ]]; then
else
while true; do
echo "正在执行主程序..."
python main.py
python /app/main.py
echo "等待 $INTERVAL 秒后再次执行..."
sleep $INTERVAL
done
Expand Down

0 comments on commit d2bd345

Please sign in to comment.