docker: add GitHub build and push workflow

Change-Id: Ic600e91129ad81f3a41d4cc9fd9b1d45d44351c3
Signed-off-by: Varun Patil <varunpatil@ucla.edu>
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
new file mode 100644
index 0000000..e091b6c
--- /dev/null
+++ b/.github/workflows/docker.yml
@@ -0,0 +1,41 @@
+name: Create and publish a Docker image
+
+on:
+  push:
+    branches: ['master']
+
+env:
+  REGISTRY: ghcr.io
+  IMAGE_NAME: ${{ github.repository }}
+
+jobs:
+  build-and-push-image:
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read
+      packages: write
+
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v3
+
+      - name: Log in to the Container registry
+        uses: docker/login-action@v2
+        with:
+          registry: ${{ env.REGISTRY }}
+          username: ${{ github.actor }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Extract metadata (tags, labels) for Docker
+        id: meta
+        uses: docker/metadata-action@v4
+        with:
+          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
+
+      - name: Build and push Docker image
+        uses: docker/build-push-action@v3
+        with:
+          context: .
+          push: true
+          tags: ${{ steps.meta.outputs.tags }}
+          labels: ${{ steps.meta.outputs.labels }}
diff --git a/docker/README.md b/docker/README.md
index 97a2816..0004ffb 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -1,7 +1,16 @@
 
 [comments]: The original author of Mini-NDN docker is Md Ashiqur Rahman (marahman@email.arizona.edu)
 
-### `docker build`
+## Running Mini-NDN inside Docker
+
+You can use the nightly build from GitHub package registry
+```bash
+docker run -m 4g --cpus=4 -it --privileged \
+           -v /lib/modules:/lib/modules \
+           ghcr.io/named-data/mini-ndn:master bash
+```
+
+## Building your own image
 
 The Dockerfile can be used directly to `build` an image from scratch.
 
@@ -12,28 +21,15 @@
     ```
   * You can then access the container through shell with,
     ```bash
-    docker run -m 4g --cpus=4 -it --rm --privileged \
+    docker run -m 4g --cpus=4 -it --privileged \
            -v /lib/modules:/lib/modules \
            minindn bin/bash
     ```
 
-* Pull from hub:
-  * Open a terminal and type:
-    ```bash
-    docker pull marahman/minindn:v0.2
-    ```
-
-  * You can then access the container through shell with,
-    ```bash
-    docker run -m 4g --cpus=4 -it --rm --privileged -e DISPLAY \
-              -v /tmp/.X11-unix:/tmp/.X11-unix \
-              -v /lib/modules:/lib/modules \
-              marahman/minindn:v0.2 bin/bash
-    ```
-
 ### Notes:
 
 * Memory (-m), CPU (--cpus) are recommended by Mini-NDN.
 * `--privileged` is mandatory for underlying [Mininet](http://mininet.org/) to utilize virtual switch
 * Root directory on `run` is `/mini-ndn` containing the installation and examples.
-* GUI may not work for now due to docker and xterm setup issues and is independent from Mini-NDN.
\ No newline at end of file
+* GUI may not work for now due to docker and xterm setup issues and is independent from Mini-NDN.
+If you intend to run the GUI, pass `-e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix` to the `docker run` command.
\ No newline at end of file