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

Add script to run container via docker cli #94

Conversation

hhenry01
Copy link
Member

@hhenry01 hhenry01 commented Feb 23, 2023

Description

  • Resolves Automate building and running base image on RPi with Docker CLI #80
  • Created deployment_scripts/ directory as I anticipate there will be more deployment specific scripting in the future, like running a set of programs
  • deployment_scripts/start_container.sh can either build and run the latest version of the workspace that is cloned, or it can run an arbitrary version built in the past
  • Docker run arguments defined under the "runArgs" field in devcontainer.json are automatically parsed and used when starting the container, but there is a caveat with respect to certain devcontainer.json fields corresponding to specific arguments. I left a comment at the top of devcontainer.json warning about this.
  • When running the container it is run as root. It should be easy to switch the user to ros, but I don't really see the point.

Verification

  • I ran the script locally on my computer, setup.sh, and build.sh. All succeeded without issue.
  • Running the script, setup.sh, and quickbuild.sh on the raspberry pi succeeded

@hhenry01 hhenry01 force-pushed the user/hhenry01/80-automate-building-and-running-base-image-on-rpi-with-docker-cli branch from 73232e6 to 162660d Compare February 23, 2023 01:51
@patrick-5546 patrick-5546 added the sim Boat Simulator team label Feb 24, 2023
Copy link
Member

@patrick-5546 patrick-5546 left a comment

Choose a reason for hiding this comment

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

Quick question: does this script only work for the RPi, or can it be used on any computer (for example if you don't want to use VS Code)?

@hhenry01
Copy link
Member Author

hhenry01 commented Feb 25, 2023

Quick question: does this script only work for the RPi, or can it be used on any computer (for example if you don't want to use VS Code)?

Works on any computer. A few bells and whistles prevent it from being 1:1 like switching the user to ros and copying config files into the container, but all essential functions are present. Again, this is all doable and not hard, I just didn't see the point if the goal is just to make it runnable on the rpi.

@patrick-5546
Copy link
Member

Would like to see this running on the Rpi, specifically how its performance compares to your laptop. I will turn on EDC PC tomorrow.

@hhenry01 hhenry01 force-pushed the user/hhenry01/80-automate-building-and-running-base-image-on-rpi-with-docker-cli branch from bf1b23f to a8987f5 Compare February 25, 2023 23:23
@hhenry01
Copy link
Member Author

Works on rpi. Added a quick_build script for convenience. Building with it on my laptop takes ~14-16 seconds after a purging while it takes 2 min on the rpi.

@hhenry01 hhenry01 enabled auto-merge (squash) February 26, 2023 00:24
@patrick-5546
Copy link
Member

patrick-5546 commented Feb 26, 2023

Can you login to the ubcsailbotsoftware GitHub account on the rpi so that we can push quick fixes? It's probably easiest to set this up outside the container and login using a PAT

Copy link
Member

@patrick-5546 patrick-5546 left a comment

Choose a reason for hiding this comment

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

General notes:

  • I think we can move deployment_scripts/ to .devcontainer/ so that everything related to docker is there
  • Would be good to add a README in deployment_scripts/ describing how and when to use each script (example commands, etc.)
  • Does this build the dev container image? Ideally this should build the base image (same tag as dev), it is 1 GB smaller

@hhenry01 hhenry01 force-pushed the user/hhenry01/80-automate-building-and-running-base-image-on-rpi-with-docker-cli branch 2 times, most recently from e29e7d8 to ab93438 Compare February 26, 2023 03:02
@hhenry01 hhenry01 force-pushed the user/hhenry01/80-automate-building-and-running-base-image-on-rpi-with-docker-cli branch from ab93438 to 7ddd425 Compare February 26, 2023 03:10
@hhenry01
Copy link
Member Author

@patrick-5546 all comments have been addressed.

…mate-building-and-running-base-image-on-rpi-with-docker-cli
Copy link
Member

@patrick-5546 patrick-5546 left a comment

Choose a reason for hiding this comment

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

Made a couple changes to fit the deployment workflow I documented in the README, if it looks good to you feel free to merge

@hhenry01 hhenry01 merged commit 302f9db into main Feb 26, 2023
@patrick-5546 patrick-5546 deleted the user/hhenry01/80-automate-building-and-running-base-image-on-rpi-with-docker-cli branch March 12, 2023 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure sim Boat Simulator team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automate building and running base image on RPi with Docker CLI
2 participants