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

Don't use host-side tools that may not be installed #1

Closed
rfay opened this issue Jul 30, 2024 · 5 comments
Closed

Don't use host-side tools that may not be installed #1

rfay opened this issue Jul 30, 2024 · 5 comments

Comments

@rfay
Copy link

rfay commented Jul 30, 2024

I see in

ddev-diffy/install.yaml

Lines 56 to 59 in c6b1e2d

post_install_actions:
- wget https://github.com/DiffyWebsite/diffy-worker/archive/refs/heads/main.zip
- unzip main.zip
- rm -f main.zip

You're using wget and unzip. In many environments these are not installed by default.

We sometimes use ddev/ddev-utilities to get around this class of problem. I note that it does have wget and unzip in it. It doesn't seem to have curl, which would be a good addition.

docker run -it --rm -v localpath:internalpath ddev/ddev-utilities wget <into_internal_path> for example

@ygerasimov
Copy link
Contributor

@rfay thank you for detailed review! We are going to use this Docker image in other integrations (clean docker set up, docksal, lando and others). So I would keep unzip and wget as part of it to make sure we have everything we need.

@stasadev
Copy link

stasadev commented Jul 31, 2024

Unpacking on the fly would be faster, the .tar.gz archive is ~7 kb smaller.

I think it can be called simply diffy-worker (change the name elsewhere accordingly).

And you need to remove the previous installation on the new ddev get to get new files with no leftovers.

--user $DDEV_UID:$DDEV_GID for other integrations would be --user $(id -u):$(id -g)

post_install_actions:
  - rm -rf diffy-worker*
  - mkdir -p diffy-worker
  - docker run -it --rm -v $(pwd)/diffy-worker:/diffy-worker --user $DDEV_UID:$DDEV_GID ddev/ddev-utilities bash -c "cd /diffy-worker && wget -qO- https://github.com/DiffyWebsite/diffy-worker/archive/refs/heads/main.tar.gz | tar xz --strip-components=1"

@rfay
Copy link
Author

rfay commented Jul 31, 2024

We are going to use this Docker image in other integrations (clean docker set up, docksal, lando and others). So I would keep unzip and wget as part of it to make sure we have everything we need

The point is that these post_install_actions are taking place on the host side, where those tools may not exist. This doesn't have anything to do with your docker image.

@rfay
Copy link
Author

rfay commented Aug 2, 2024

This was a good idea, seems to be working fine.

@ygerasimov
Copy link
Contributor

Closing this issues as it is implemented.

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

No branches or pull requests

3 participants