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

update to modern docker package #3

Merged
merged 5 commits into from
Dec 11, 2023

Conversation

liudonghua123
Copy link
Contributor

No description provided.

Copy link
Owner

@lukapeschke lukapeschke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for creating this! The changes to how the image is retrieved and to the client lib usage look good to me, but the changes to _insert_step seem to break the existing behaviour... Maybe those should be done in another PR ?

entrypoint.py Outdated
def __init__(self):
super(MainObj, self).__init__()
super(Main, self).__init__()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
super(Main, self).__init__()
super().__init__()

Heh, Python has changed a lot since I wrote this :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I didn't notice this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because Main is not extend any explicit base class, so super().__init__() is optional and recommend to ignore it IMO.

entrypoint.py Outdated
Comment on lines 37 to 43
# ignore the end "# buildkit" comment
step = re.sub("\s*#.+$", "", step)
if "#(nop)" in step:
to_add = step.split("#(nop) ")[1]
else:
to_add = ("RUN {}".format(step))
# step may contains "/bin/sh -c ", just ignore it
to_add = "{}".format(step.replace("/bin/sh -c ", ""))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be changed in another PR ? The results with the current docker image and one built from your branch are quite different:

With the current image:

❯ docker run --rm -v '/var/run/docker.sock:/var/run/docker.sock' lukapeschke/dfa 21ab84251c7b
FROM lukapeschke/dfa:latest
ADD file:093f0723fa46f6cdbd6f7bd146448bb70ecce54254c35701feeceb956414622f in /
CMD ["/bin/sh"]
RUN /bin/sh -c apk add --update python3 wget      \
    && wget -O - --no-check-certificate https://bootstrap.pypa.io/get-pip.py | python3      \
    && apk del wget      \
    && pip3 install -U docker-py      \
    && yes | pip3 uninstall pip
COPY file:df2a17029ab5f655279e92b51f29046f182eb0a4a5457ad06b2338387bcbbd20 in /root
ENTRYPOINT ["/root/entrypoint.py"]

With the image build from your PR:

❯ docker run --rm -v '/var/run/docker.sock:/var/run/docker.sock' updated-image 21ab84251c7b
FROM lukapeschke/dfa:latest
/bin/sh -c
/bin/sh -c
apk add --update python3 wget      \
    && wget -O - --no-check-certificate https://bootstrap.pypa.io/get-pip.py | python3      \
    && apk del wget      \
    && pip3 install -U docker-py      \
    && yes | pip3 uninstall pip
/bin/sh -c
/bin/sh -c

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the code 😄 It should fixed in the following commits.

entrypoint.py Outdated Show resolved Hide resolved
Copy link
Owner

@lukapeschke lukapeschke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just fixed a missing RUN, script output looks good now 🙂 Thanks a lot for your contribution!

@lukapeschke lukapeschke merged commit d8aa11b into lukapeschke:master Dec 11, 2023
@liudonghua123 liudonghua123 deleted the modern-docker-package branch December 11, 2023 14:53
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