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

Swiftformat not working from the docker image #1626

Open
rswave opened this issue Feb 13, 2024 · 2 comments
Open

Swiftformat not working from the docker image #1626

rswave opened this issue Feb 13, 2024 · 2 comments
Labels

Comments

@rswave
Copy link

rswave commented Feb 13, 2024

I'm trying to use swiftformat from the docker image and it always throws an error about not finding swiftformat.

Here are my steps
Download the image:

docker pull ghcr.io/nicklockwood/swiftformat

Run it on the current directory which is my project folder

docker run -v `pwd`:`pwd`:rw -w `pwd` --rm ghcr.io/nicklockwood/swiftformat swiftformat ios
error: File not found at /Users/User/project/ios/swiftformat.

# just to test I moved to root folder and tried again
cd /
docker run -v `pwd`:`pwd`:rw -w `pwd` --rm ghcr.io/nicklockwood/swiftformat swiftformat .
error: File not found at /swiftformat.

I have tried different directories and still get the same error. Checked the path and swiftformat is present. I accessed the terminal in the docker and it is showing the binary in the /usr/bin folder when I run which swiftformat.

And this command like --help works and outputs properly

docker run -v `pwd`:`pwd`:rw -w `pwd` --rm ghcr.io/nicklockwood/swiftformat swiftformat --help

I'm running the image on Apple M1 Sonoma 14.1

I tried building the image myself on Apple M1 and it works as expected but when I build it on a x86 machine that image wouldn't work on the Apple SIlicone is another observation. The error I get is the same error I posted above.

@nicklockwood
Copy link
Owner

I don't use Docker myself and I'm not sure how to test it, but @vox-humana submitted the Docker action originally - perhaps he has some insight?

@vox-humana
Copy link
Contributor

Hey @rswave Dockerfile already has swiftformat as an entry point so you don't need to provide an extra swiftformat argument (see some examples in the README).
So in your case this should work:

docker run -v `pwd`:`pwd`:rw -w `pwd` --rm ghcr.io/nicklockwood/swiftformat ios

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

No branches or pull requests

3 participants