Skip to content

Adds dev container and docs #1499

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

Merged
merged 8 commits into from
Apr 14, 2020
Merged

Adds dev container and docs #1499

merged 8 commits into from
Apr 14, 2020

Conversation

cmoog
Copy link
Contributor

@cmoog cmoog commented Apr 6, 2020

Closes #1498

@nhooyr
Copy link
Contributor

nhooyr commented Apr 7, 2020

Nice, I like this.

m Outdated
container_id=$(docker container inspect --format="{{.Id}}" $container_name 2>/dev/null)

if [ $? -eq "0" ]; then
echo "--- Killing $container_name"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To kill an existing instance of the dev container. much better than having to exec bash back into the container and kill all the watch processes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the watch process be running in the foreground? Then u can just ctrl+c.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not if you get detached from the container, which happens to me all the time. When my ssh loses connection for example.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you get detached, the container should exit. You'd want to pass in -it for that to work.

m Outdated
fi
set -e

echo "--- Spawning $container_name"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the container is already running, we should just reuse it.

Copy link
Contributor

@nhooyr nhooyr Apr 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I guess that wouldn't be very useful since you can just use the code-server terminal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having to use the code-server terminal would not be optimal though considering it's constantly reloading, losing its history, etc.

@cmoog cmoog force-pushed the dev-container branch 3 times, most recently from bb95f7a to 43b7d98 Compare April 10, 2020 05:54
@cmoog
Copy link
Contributor Author

cmoog commented Apr 14, 2020

Anything preventing this from merging? @nhooyr

echo "--- Spawning $container_name"
container_id=$(docker run \
-it \
--privileged \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does it need to be privileged?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I was considering vms when I added that. But you're right– not needed for now.

@@ -0,0 +1,46 @@
#!/usr/bin/env bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a comment explaining what the script does.

Copy link
Contributor

@nhooyr nhooyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from documenting what the script does, looks solid to me. Nice work! 🚀

@@ -1,4 +1,6 @@
#!/usr/bin/env bash
# exec.sh opens an interactive bash session inside of a docker container
# for improved isolation during development
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate that it reuses the container if it exists? And starts it if stopped.

@cmoog cmoog merged commit 29b6115 into master Apr 14, 2020
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 this pull request may close these issues.

Dev container for code-server
2 participants