docker: add GitHub build and push workflow

Change-Id: Ic600e91129ad81f3a41d4cc9fd9b1d45d44351c3
Signed-off-by: Varun Patil <varunpatil@ucla.edu>
This commit is contained in:
Varun Patil committed 2022-10-14 17:12:29 -07:00
1 parent 1e720875d2
commit aad8dbea87
2 files changed
+54 -17

No files matched your search

+41
View File
@@ -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 }}
+13 -17
View File
@@ -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 @@ The Dockerfile can be used directly to `build` an image from scratch.
```
* 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.
* 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.