Skip to content

A linux based container for developing Leap71/PicoGK

Notifications You must be signed in to change notification settings

CorrieVS/PicoGK_Docker

Repository files navigation

Develop PicoGK in a Docker container

Developer's preferring Linux can use this Dockerized development environment based on Ubuntu 22.04. The tools include a Dockerfile and associated docker-compose.yaml for easy container configuration; a set of bash utilities to simplify command line actions; and a Visual Studio Code devcontainer description to streamline .NET development and provide C# extensions in the container.

The container has these features:

  • Ubuntu 22.04 with .NET 7.0
  • Volumes for persistent storage
  • Symlinks /home/$USER/picogk to /root/picogk in the container so you can work as yourself

Requirements

Setup

Clone the repo and source the bash utilities for simplified docker commands:

git clone --recursive https://github.com/CorrieVS/PicoGK_Docker.git
cd PicoGK_Docker
echo "source $(pwd)/Docker/bash_utils" >> ~/.bashrc
echo "export PICOGK_DIRECTORY=$(pwd)" >> ~/.bashrc
source ~/.bashrc

Build and Run

Build the docker image with

pico-build

Run the container and open a shell inside it

pico-start
pico-shell

Here is the full set of commands:

Command Function
pico-build build the container from docker files
pico-start gather host user info, apply ownership to the host user, start container in detached mode
pico-stop stop container and remove it
pico-shell open a bash shell in the container
pico-log view the docker container log
pico-dir export the PICOGK_DIRECTORY env variable, usage: pico-dir <path>

Using git

Generally it's recommended to run git commands from the host only. This avoids continuity errors in the development process. Technically you can run git in the container, but proceed with caution if you choose to do so.

Develop in Visual Studio Code

You can develop in Visual Studio Code on the host by simply opening your project and a terminal, then doing pico-start and pico-shell in the terminal. Your files are available on the host and changes you make will be reflected in the container.

Users who want to develop in VSC and use the C# Dev Kit extensions can open their code inside the container. To do this type "F1" to activate the command bar in Visual Studio Code, and type "Dev Containers: Reopen in Container". You should see "picogk_c" in the drop down - select it if it is not automatically selected. VSC will reopen the folder, load the C# Dev Kit extension, and open a terminal window in the container.

Create a C# .NET Application

To create a .NET project in the container, click your cursor in the VSC terminal and navigate to picogk/projects. Create a new console app, build and run it to ensure your setup is funtioning - the program will print "Hello World!" to the console.

dotnet new console -n HelloWorld
cd HelloWorld
dotnet build
dotnet run

Now you can continue with Getting Started. Be sure to edit the PicoGK/PicoGK__Config.cs to set strPicoGKLib to "/usr/local/lib/picogk.1.0.so". The app does not consume the linux shared library .so extension properly without the full path.

Docker Config

Parameters for Docker are set in Docker/docker-compose.yaml.

These are set by default to use NVIDIA runtime. Comment them out to not use it, and uncomment the volume /dev/dri:

runtime: nvidia
environment:
    - NVIDIA_DRIVER_CAPABILITIES=all
    - NVIDIA_VISIBLE_DEVICES=all

...
volumes:
    - /dev/dri:/dev/dri

About

A linux based container for developing Leap71/PicoGK

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published