# Deploying Mojo::Darkpan via Docker


## Links

*   {{< perl-metacpan-module "Mojo::Darkpan" >}}
*   https://github.com/rshingleton/Mojo-Darkpan


## Dockerfile

The repo has a Dockerfile that appears suitable.

There does not appear to be an image that is published into Docker Hub.


## Docker-Image-Mojo-Darkpan

I make a project
https://gitlab.com/jtrowe/docker-image-mojo-darkpan
that will use GitLab CI to build a Docker image.

The original Dockerfile in the Mojo::Darkpan repo proved
to be a little fussy for me.

So I just wrote my own Dockerfile, and it works ok.

I upload the images into Docker Hub:
https://hub.docker.com/repository/docker/jtrowe/mojo-darkpan
.


## Deploying In My Home Lab

Add dns entry for darkpan.home.jrowe.org.

Create a setup.sh script.

```sh
iface="enp0s31f6"    
ip=$(dig darkpan.home.jrowe.org +short)
sudo ip addr add $ip/16 dev $iface
```

This needs to be run on server reboot.
I've not yet automated this or figured out how I might want to make
it persistent.

Create a run.sh script.

```sh

name="mojo-darkpan"
tag="0.06"
image="docker.io/jtrowe/$name:$tag"

# the ipv4 address associated with the dns name
# I swear that I have previously used the dns name itself
ip="...."

mkdir --parents darkpan

opts="$opts --init"
opts="$opts --name $name"
opts="$opts --publish $ip:80:3000"
opts="$opts --mount type=bind,src=$(pwd)/darkpan,dst=/var/lib/mojo-darkpan/darkpan"
opts="$opts --rm"
opts="$opts --user $(id --user):$(id --group)"

docker run $opts $image
```

Then just `bash run.sh`.


