GitHub Packages

This section provides step-by-step instructions on how to pull and run a Docker image from GitHub Packages for your project. Using Docker from GitHub Packages allows users to run their applications consistently across different platforms, ensuring portability and reducing compatibility issues. A list of possible versions of GitHub packages for WinNet can be accessed here.

Prerequisites

Before you begin, ensure you have the following:

  1. Docker: Install Docker on your local machine. You can download and install Docker from Docker's official website.
  2. GitHub Account: You need a GitHub account to access GitHub Packages.
  3. Personal Access Token: Generate a personal access token (PAT) with the read:packages scope. You can create a PAT from your GitHub settings.

Steps to Use the Dockerfile

Authenticate Docker to GitHub Packages

Run the following command to authenticate Docker to GitHub Packages using your GitHub username and personal access token:

echo $GITHUB_TOKEN | docker login ghcr.io -u YOUR_GITHUB_USERNAME --password-stdin

Replace YOUR_GITHUB_USERNAME with your GitHub username and set the GITHUB_TOKEN environment variable to your personal access token.

Pull the Docker Image

Use the docker pull command to download the Docker image from GitHub Packages:

sudo docker pull ghcr.io/nuc-astro/winnet:latest

If you want a specific version, replace latest with the desired tag.

Run the Docker Container

After pulling the image, run a container using the docker run command:

sudo docker run --net=host --env="DISPLAY=$DISPLAY" -it ghcr.io/nuc-astro/winnet:latest

Example

Here’s a complete example assuming your GitHub username is winnet_user and you saved your github token in the environment variable GITHUB_TOKEN:

# Authenticate Docker to GitHub Packages
echo $GITHUB_TOKEN | docker login ghcr.io -u winnet_user --password-stdin
# Pull the Docker image
sudo docker pull ghcr.io/nuc-astro/winnet:latest
# Run the Docker container
sudo docker run --net=host --env="DISPLAY=$DISPLAY" -it ghcr.io/nuc-astro/winnet:latest

Additional Notes

If your application requires persistent storage, you can mount volumes using the -v flag. For example:

sudo docker run --net=host --env="DISPLAY=$DISPLAY" -v /local/path:/container/path -it ghcr.io/nuc-astro/winnet:latest

Hence, you can make the run folder accessible to your system, using a folder called "run_test", by:

mkdir run_test
sudo docker run --net=host --env="DISPLAY=$DISPLAY" -v ${PWD}/run_test/:/home/winnet/WinNet/runs/ -it ghcr.io/nuc-astro/winnet:latest

For more information on using Docker, refer to the Docker documentation.