Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove binutils will also remove gcc #1100

Merged
merged 1 commit into from
Jul 31, 2023

Conversation

qrzbing
Copy link
Contributor

@qrzbing qrzbing commented Jul 31, 2023

fix #1097

@qrzbing
Copy link
Contributor Author

qrzbing commented Jul 31, 2023

跑了一下 action,感觉没有问题了

@Haibersut Haibersut merged commit 8288978 into lss233:browser-version Jul 31, 2023
@Haibersut
Copy link
Collaborator

thx,后续可能要优化下大小,好像这个remove没用

@qrzbing
Copy link
Contributor Author

qrzbing commented Jul 31, 2023

因为 Dockerfile 中的每一条命令都会增大空间,对于目前的情况,想要优化大小的话最佳方式可能是把所有命令都写到一条里面。

@qrzbing
Copy link
Contributor Author

qrzbing commented Jul 31, 2023

简单写了一个 all in one 的版本:

FROM python:3.11.2-slim-bullseye

ENV DEBIAN_FRONTEND=noninteractive

COPY ./fonts/sarasa-mono-sc-regular.ttf /usr/share/fonts/

RUN mkdir -p /app
WORKDIR /app

COPY requirements.txt /app

RUN apt-get update && \
    apt install --no-install-recommends xvfb binutils build-essential qtbase5-dev wkhtmltopdf ffmpeg -yq && \
    (strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 || true) && \
    apt-get clean && \
    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
    rm -rf /var/lib/apt/lists/* && \
    pip install --no-cache-dir -r requirements.txt && pip cache purge && \
    apt-get remove --purge -yq binutils build-essential

COPY . /app

CMD ["/bin/bash", "/app/docker/start.sh"]

然后对比了一下:

$ docker images
REPOSITORY                                  TAG               IMAGE ID       CREATED         SIZE
allinonebot                                 latest            2c76ff3d7f96   2 minutes ago   1.16GB # all in one Dockerfile
lss233/chatgpt-mirai-qq-bot                 browser-version   f9453d3ddfe5   3 hours ago     1.22GB # new build
lss233/chatgpt-mirai-qq-bot                 <none>            011a433349da   3 days ago      994MB  # old build

大概能减小 60M 左右空间,和上一个版本相比增大了大概 200M 空间,似乎并不是一个很好的优化方式。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants