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 deno as entrypoint #57

Closed
DanielRamosAcosta opened this issue Jun 19, 2020 · 8 comments · Fixed by #69
Closed

Don't use deno as entrypoint #57

DanielRamosAcosta opened this issue Jun 19, 2020 · 8 comments · Fixed by #69

Comments

@DanielRamosAcosta
Copy link

I think it should be a docker-entrypoint.sh file, like node does.

This would allow using the image for launching other kind of scripts, and allowing Gitlab CI to work, for example.

I cant PR if you want. Cheers!

@hayd
Copy link
Contributor

hayd commented Jun 20, 2020

Thanks for opening an issue / bringing this up!

Could you explain the benefit? What is it solving? How would this change the usage? (How do you call bash in the node image?)

Why doesn't --entrypoint suffice? Why does it break gitlab?

This was suggested and introduced by @Minigugus in #23. Would be interested to hear their counter.

I'm not adverse to this change, but I did think it was neat... But I just want to understand more fully.

@Minigugus
Copy link
Contributor

@DanielRamosAcosta Oh nice 😮 Pretty cool to bypass --entrypoint easly 😆

@hayd Currently, docker run -it --rm hayd/deno:alpine-0.35.0 bash runs deno bash. docker-entrypoint.sh solve the problem by detecting that bash is a command name, so it just run bash, but still runs deno bash.ts in docker run -it --rm hayd/deno:alpine-0.35.0 bash.ts for instance. --entrypoint is cool but it doesn't make it easy to pass command lines not using deno. Also, some users can be confused not passing the command name (deno) in the command line. 😉

@hayd
Copy link
Contributor

hayd commented Jun 20, 2020

@DanielRamosAcosta Happy to take PR!

@hayd
Copy link
Contributor

hayd commented Jun 22, 2020

One annoying part of this is that test is a unix command so this would be breaking (at the moment running test would run deno test). I wonder if there is a workaround for that part 🤔

@Minigugus
Copy link
Contributor

It's possible to hard-code Deno commands in docker-entrypoint.sh... 😕

@DanielRamosAcosta
Copy link
Author

DanielRamosAcosta commented Jun 22, 2020

Give me some time, I'll try to prepare a PR during this week 😄 , thanks you all @Minigugus @hayd

@hayd
Copy link
Contributor

hayd commented Jul 15, 2020

something like this?

#!/bin/bash
set -e

# how to test if $1 is in (run, cache, bundle, completions, eval, fmt, lint, repl, test, types) ?
if [ "$1" = 'run' ]; then
    exec gosu deno "$@"
fi

exec "$@"

https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#entrypoint

@Minigugus
Copy link
Contributor

Minigugus commented Jul 15, 2020

@hayd

how to test if $1 is in (run, cache, bundle, completions, eval, fmt, lint, repl, test, types) ?

#!/bin/bash
set -e

case "$1" in
    run | \
    cache | \
    bundle | \
    completions | \
    eval | \
    fmt | \
    lint | \
    repl | \
    test | \
    types) \
    exec gosu deno "$@";;
esac

exec "$@"

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 a pull request may close this issue.

3 participants