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

Unable to run --do CODE from docker images (edit: and v0.0.18) #194

Closed
booniepepper opened this issue Apr 23, 2024 · 7 comments
Closed

Unable to run --do CODE from docker images (edit: and v0.0.18) #194

booniepepper opened this issue Apr 23, 2024 · 7 comments

Comments

@booniepepper
Copy link
Contributor

I'm trying to run one-liners from the docker image, but it doesn't seem to work:

$ docker run --rm ghcr.io/refaktor/rye -do 'print "Hello"'
2024/04/23 15:55:38 Error reading line: EOF
Welcome to Rye console. Use ls for current or lsp or lsp\ "prin" to list parent context.
×> ⏎

If I build locally, the flag works fine:

❯ ./rye -do 'print "hello"'
hello

And if I build the docker image locally, it also works fine:

❯ docker buildx build .
[+] Building 22.0s (13/13) FINISHED        docker:default
 => [internal] load build definition from Dockerfil  0.0s
 => => transferring dockerfile: 302B                 0.0s
 => [internal] load metadata for docker.io/library/  0.0s
 => [internal] load metadata for docker.io/library/  0.4s
 => [internal] load .dockerignore                    0.0s
 => => transferring context: 61B                     0.0s
 => [builder 1/5] FROM docker.io/library/golang:1.2  0.0s
 => CACHED [bin 1/2] FROM docker.io/library/alpine:  0.0s
 => [internal] load build context                    1.0s
 => => transferring context: 119.96MB                1.0s
 => CACHED [builder 2/5] RUN apk add --no-cache git  0.0s
 => CACHED [builder 3/5] WORKDIR /go/src/rye         0.0s
 => [builder 4/5] COPY . .                           0.7s
 => [builder 5/5] RUN mkdir -p /out &&     go buil  19.5s
 => [bin 2/2] COPY --from=builder /out/rye /         0.1s 
 => exporting to image                               0.1s 
 => => exporting layers                              0.1s 
 => => writing image sha256:bdeb5329a27f089008f9bb1  0.0s 
❯ docker run --rm booniepepper/rye -do 'print "Hello"'
Hello
@booniepepper
Copy link
Contributor Author

Actually, it looks like it may be an issue with 0.0.18 that has since been fixed

❯ git checkout v0.0.18
HEAD is now at 2b78b39 Merge branch 'main' of github.com:refaktor/rye into scriptloc

❯ go build
go: downloading golang.org/x/term v0.17.0
go: downloading golang.org/x/crypto v0.20.0
go: downloading github.com/refaktor/liner v1.2.6
go: downloading github.com/rivo/uniseg v0.2.0
go: downloading golang.org/x/sys v0.17.0

❯ ./rye -do 'print "hello"'
Welcome to Rye console. Use ls for current or lsp or lsp\ "prin" to list parent context.
×> ^C

@booniepepper booniepepper changed the title Unable to run --do CODE from docker images Unable to run --do CODE from docker images (edit: and v0.0.18) Apr 23, 2024
@booniepepper
Copy link
Contributor Author

I think this will simply be solved when the next release is out

@refaktor
Copy link
Owner

refaktor commented Apr 24, 2024

@booniepepper Yes, I've checker. v0.0.18 accepted -do flag, but only after accepting a file or dot ".", so after it loaded some file. After 18 I added option that -do flag also works with no input files. But I've merger your PR and made v0.0.19 release and I get this ... as I said, I rarely use Docker, so there is probably something I don't understand:

[:. Linux terminal .:] docdoc': docker run ghcr.io/refaktor/rye -do "print 123 + 123"
2024/04/24 20:09:58 open -do: no such file or directory
[:. Linux terminal .:] docker run ghcr.io/refaktor/rye:latesrye:latest -do "print 123 + 123"
2024/04/24 20:10:01 open -do: no such file or directory
[:. Linux terminal .:] docker run ghcr.io/refaktor/rye@sha256:e73d6d8a7c66dd65e578271e1fc4e625e992108b748f3103cc748dab034e6dfd -do "print 123 + 123"
246

@booniepepper
Copy link
Contributor Author

Hmm... it seems to works for me right now

$ docker run --rm ghcr.io/refaktor/rye -do '"hello" |print'
Unable to find image 'ghcr.io/refaktor/rye:latest' locally
latest: Pulling from refaktor/rye
50967c6354e2: Pull complete
250c06f7c38e: Pull complete
01948aa61ab5: Pull complete
Digest: sha256:e73d6d8a7c66dd65e578271e1fc4e625e992108b748f3103cc748dab034e6dfd
Status: Downloaded newer image for ghcr.io/refaktor/rye:latest
hello

$ docker run --rm ghcr.io/refaktor/rye -do 'print 123 + 123'
246

@booniepepper
Copy link
Contributor Author

Also working for me with the 0.0.19 tag explicitly:

docker run ghcr.io/refaktor/rye:0.0.19 -do 'print 123 + 123'
Unable to find image 'ghcr.io/refaktor/rye:0.0.19' locally
0.0.19: Pulling from refaktor/rye
Digest: sha256:e73d6d8a7c66dd65e578271e1fc4e625e992108b748f3103cc748dab034e6dfd
Status: Downloaded newer image for ghcr.io/refaktor/rye:0.0.19
246

@booniepepper
Copy link
Contributor Author

booniepepper commented Apr 24, 2024

I might chalk up the errors you're seeing to something like locally cached containers/images from previous versions. Docker leaves... a lot to be cleaned up

@refaktor
Copy link
Owner

I've managed to convince docker to update it's local copy and now it works with latest for me also. I had to use:

docker run --update always ghcr.io/refaktor/rye:latest -do "print 123 + 123"

And now it works even without --update always. Various docker image|build prune-s didn't work. So I consider this issue closed. Thanks for opening it and clearing this up.

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

2 participants