fly-apps / laravel-docker

Base Docker images for use with Laravel on Fly.io
43 stars 8 forks source link

Add line to automatically `cd` to `/var/www/html` in bash #1

Closed dejagersh closed 10 months ago

dejagersh commented 1 year ago

Hi!

Every time I run fly ssh console, the first thing I always do is cd /var/www/html. Now, for some projects I've added this line so I automatically get moved there, but it would be great if we could have something like this in the default Dockerfile.

Also, this change only works when going into bash. Is there a way to change the default shell to bash? I tried the change that you see in the PR, but I don't think it works.

This PR is mostly meant as a starting point of a discussion :)

fideloper commented 1 year ago

Hey! Let me check to see if there are unintended consequences of that. Probably is fine tho!

dejagersh commented 1 year ago

So the SHELL ["/bin/bash"] thing doesn't work, but I found this tool called https://github.com/casey/just which is quite convenient. I have a justfile like this:

ssh:
    fly ssh console --app=appname --pty --command="/bin/bash"

tinker:
    fly ssh console --app=appname --pty --command="php /var/www/html/artisan tinker"

And then you can just run just ssh to SSH into the VM, or just tinker to open a tinker shell.

fideloper commented 1 year ago

Ah neat - is the change made in this PR relevant if you're using just?

To clarify: It sounds like this change doesn't help?

dejagersh commented 1 year ago

Ah neat - is the change made in this PR relevant if you're using just?

To clarify: It sounds like this change doesn't help?

SHELL ["/bin/bash"]: this doesn't do anything. Well it probably does, but it does not do what I expect it to do 😂

&& echo 'cd /var/www/html' >> /root/.bashrc \: This does do something and I'm adding it to each of my projects, but it only does something when you go into bash. Whether it's useful for other people as well, I'm not sure. Your call 😁 I won't be offended if you close the PR 😜

dejagersh commented 10 months ago

I don't think this is necessary anymore, right? @fideloper I am not sure what you did but now when I fly ssh console I always end up in /var/www/html :)