Skip to main content

Working from home

Programming on the Rover1 Debix itself can be a quick way to test new code, however you might want to try things out locally (or at home) first. To do this easily, we provide a Docker image that has all of the necessary tools and libraries installed and setup (read about docker if this is new to you, we will not cover the basics here).

Structuring your project

When developing a service for your pipeline, we suggest that you create a project directory in which there is a single Makefile along with the rest of your files for your program. For example the directory might look like this:

myproj
├── Makefile
├── main.py
├── test.py
...

Then paste the following contents into the Makefile and run make docker inside the myproj directory to enter the docker container. All of the files in myproj will be mounted inside the docker container in /home/dev/work. Any changes to the myproj directory inside the docker container will persist on your host's file system.

Makefile
.PHONY: clean docker


define make_docker =
if [ -z "$(sudo docker ps -a | grep ase-dev-container)" ]; then
echo ">> creating dev container"

sudo docker run -w /home/dev/work --hostname dev -it --name ase-dev-container \
--net=host \
--cap-add=SYS_PTRACE --security-opt seccomp=unconfined \
-v "$(pwd)":/home/dev/work:z \
aselabsvu/ase-dev /usr/bin/bash

else
echo ">> found existing dev container"
sudo docker start ase-dev-container
sudo docker exec -it ase-dev-container /usr/bin/bash
fi
endef

docker: ; @$(value make_docker)


define make_clean =
sudo docker stop ase-dev-container || echo "already stopped"
sudo docker rm ase-dev-container || echo "container already removed"
sudo docker image rm aselabsvu/ase-dev || echo "image already removed"
endef

clean: ; @$(value make_clean)


.ONESHELL:
  • make docker - Run this command inside your project directory and a shell will be started and you will immediately have access to all the tools and libraries necessary for the project.
  • make clean - Run this command to stop and remove the container and image.

VSCode offers the a handy extension that lets you write code as if you were inside the container itself. The following is a short guide showing how to get started with this extension

  • Step 1: Search for the "Dev Containers" extension in VSCode and install it.
  • Step 2: Using the Makefile above, simply run the make docker command inside your project directory and exit the shell again by pressing Ctrl+D or typing "exit". Now the docker container is started and should become available under Remote Explorer -> Dev Containers. Connect to it and you should be able to work inside of the docker container with the same files as your on your host.

"vscode screenshot"