Skip to content

Commit

Permalink
fix 1/3: introduce scudo-malloc
Browse files Browse the repository at this point in the history
  • Loading branch information
IceCodeNew committed May 30, 2024
1 parent 1ea92d9 commit 7ab4761
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 12 deletions.
14 changes: 10 additions & 4 deletions saveweb/Dockerfile.chouti
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ USER root:root
RUN apk update \
&& apk --no-progress --no-cache add \
curl \
scudo-malloc \
&& apk --no-progress --no-cache upgrade \
&& rm -rf /var/cache/apk/*;

Expand All @@ -28,17 +29,22 @@ RUN echo 'source /home/nonroot/.cargo/env' > /home/nonroot/.bashrc \
/home/nonroot/.venv/bin/activate \
/home/nonroot/.venv/bin/chouti_links;

USER root:root
RUN chown -R nonroot:nonroot /home/nonroot/

FROM cgr.dev/chainguard/python:latest AS assets
# be aware of the ownership of /home/nonroot/
# refer to: https://github.com/moby/buildkit/issues/4964
COPY --from=build --chown=nonroot:nonroot /home/nonroot/ /emptydir/home/nonroot/
COPY --from=build /usr/lib/libscudo.so /emptydir/usr/lib/


FROM cgr.dev/chainguard/python:latest
# be aware of the ownership of /home/nonroot/
COPY --link --from=build /home/ /home/
COPY --link --from=assets /emptydir/ /
WORKDIR /home/nonroot/

ENV TZ=Asia/Taipei
ENV VIRTUAL_ENV=/home/nonroot/.venv
ENV PATH="${VIRTUAL_ENV}/bin:/home/nonroot/.cargo/bin:${PATH}"
ENV LD_PRELOAD=/usr/lib/libscudo.so

ENTRYPOINT [ "python3" ]
CMD [ "/home/nonroot/.venv/bin/chouti_links" ]
14 changes: 10 additions & 4 deletions saveweb/Dockerfile.huashijie
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ USER root:root
RUN apk update \
&& apk --no-progress --no-cache add \
curl \
scudo-malloc \
&& apk --no-progress --no-cache upgrade \
&& rm -rf /var/cache/apk/*;

Expand All @@ -26,17 +27,22 @@ RUN echo 'source /home/nonroot/.cargo/env' > /home/nonroot/.bashrc \
/home/nonroot/.venv/bin/activate \
/home/nonroot/.venv/bin/huashijie_work;

USER root:root
RUN chown -R nonroot:nonroot /home/nonroot/

FROM cgr.dev/chainguard/python:latest AS assets
# be aware of the ownership of /home/nonroot/
# refer to: https://github.com/moby/buildkit/issues/4964
COPY --from=build --chown=nonroot:nonroot /home/nonroot/ /emptydir/home/nonroot/
COPY --from=build /usr/lib/libscudo.so /emptydir/usr/lib/


FROM cgr.dev/chainguard/python:latest
# be aware of the ownership of /home/nonroot/
COPY --link --from=build /home/ /home/
COPY --link --from=assets /emptydir/ /
WORKDIR /home/nonroot/

ENV TZ=Asia/Taipei
ENV VIRTUAL_ENV=/home/nonroot/.venv
ENV PATH="${VIRTUAL_ENV}/bin:/home/nonroot/.cargo/bin:${PATH}"
ENV LD_PRELOAD=/usr/lib/libscudo.so

ENTRYPOINT [ "python3" ]
CMD [ "/home/nonroot/.venv/bin/huashijie_work" ]
14 changes: 10 additions & 4 deletions saveweb/Dockerfile.lowapk_v2
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ USER root:root
RUN apk update \
&& apk --no-progress --no-cache add \
curl \
scudo-malloc \
&& apk --no-progress --no-cache upgrade \
&& rm -rf /var/cache/apk/*;

Expand All @@ -26,17 +27,22 @@ RUN echo 'source /home/nonroot/.cargo/env' > /home/nonroot/.bashrc \
/home/nonroot/.venv/bin/activate \
/home/nonroot/.venv/bin/lowapk_v2;

USER root:root
RUN chown -R nonroot:nonroot /home/nonroot/

FROM cgr.dev/chainguard/python:latest AS assets
# be aware of the ownership of /home/nonroot/
# refer to: https://github.com/moby/buildkit/issues/4964
COPY --from=build --chown=nonroot:nonroot /home/nonroot/ /emptydir/home/nonroot/
COPY --from=build /usr/lib/libscudo.so /emptydir/usr/lib/


FROM cgr.dev/chainguard/python:latest
# be aware of the ownership of /home/nonroot/
COPY --link --from=build /home/ /home/
COPY --link --from=assets /emptydir/ /
WORKDIR /home/nonroot/

ENV TZ=Asia/Taipei
ENV VIRTUAL_ENV=/home/nonroot/.venv
ENV PATH="${VIRTUAL_ENV}/bin:/home/nonroot/.cargo/bin:${PATH}"
ENV LD_PRELOAD=/usr/lib/libscudo.so

ENTRYPOINT [ "python3" ]
CMD [ "/home/nonroot/.venv/bin/lowapk_v2" ]

0 comments on commit 7ab4761

Please sign in to comment.