Dockerfile
==========

This repository contains dockerfiles to package FEED
into a docker image.

The following hierarchy was built:

* EPICS base

```bash
docker build -t lbnl-atg/epics_base -f Dockerfile.epics_base .
```

* EPICS modules

```bash
docker build -t lbnl-atg/epics_modules -f Dockerfile.epics_modules .
```

* FEED

```bash
DOCKER_BUILDKIT=1 docker build -t lbnl-atg/epics_feed --ssh default=~/.ssh/id_ed25519 -f Dockerfile.epics_feed .
```

* FEED specific ALSU configuration

```bash
DOCKER_BUILDKIT=1 docker build -t lbnl-atg/feed_alsu --ssh default=~/.ssh/id_ed25519 -f Dockerfile.feed_alsu .
```

Another option is to use the Makefile:

```bash
make
```

This will build all the images.

How to run
==========

In order to run an image interactively:

```bash
docker run --rm -it --name test --network host lbnl-atg/<IMAGE_NAME> bash
```

To run the FEED ALSU image, which containts the IOC:

```bash
docker run --rm -it --name feed_alsu --net host mohs.dhcp.lbl.gov/lbnl-atg/epics_feed_alsu
```

In order to run the ALSU Phoebus image you can do:

```bash
xhost local:root
docker run --rm -it --name phoebus_alsu --network="host" -e DISPLAY=${DISPLAY} -v /tmp/.X11-unix:/tmp/.X11-unix -v $HOME/.Xauthority:/root/.Xauthority mohs.dhcp.lbl.gov/lbnl-atg/epics_phoebus_alsu
```

In case you want to login to a container you can do:

```bash
docker exec -it <container_name> bash
```
Troubleshoot
============

If you get an error like:

```
could not parse ssh: [default=/home/lucasrusso/.ssh/id_ed25519]: stat /home/lucasrusso/.ssh/id_ed25519: no such file or directory
```

Change it to an exisiting SSH key in the `Makefile`, such as RSA or the one which
gives you access to the FEED repository. For example, from:

```bash
--ssh default=$(HOME)/.ssh/id_ed25519
```

To:


```bash
--ssh default=$(HOME)/.ssh/id_rsa
```
