Skip to content

Commit

Permalink
Add launcher
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed Oct 12, 2023
1 parent fe09ac6 commit 6e16c51
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/buiild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
builder: ${{ steps.buildx.outputs.name }}
push: ${{ steps.tag.outputs.do_push }}
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ steps.tag.outputs.image_tag }}
# - name: Build runtime image
Expand Down
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Dockerfile for EPICS OPI PHoebus
FROM ubuntu:20.04


ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y locales
Expand All @@ -25,5 +24,5 @@ RUN git clone https://github.com/ControlSystemStudio/phoebus.git \
WORKDIR ${ROOT}
RUN mvn -DskipTests clean install

ENTRYPOINT ["java", "-jar", "phoebus-product/target/product-${VERSION}.jar", \
"-server", "4918", "--add-modules=ALL-SYSTEM"]
RUN ln -s phoebus-product/target/product-${VERSION}.jar phoebus.jar
ENTRYPOINT ["java", "-jar", "phoebus.jar", "-server", "4918", "--add-modules=ALL-SYSTEM"]
39 changes: 39 additions & 0 deletions phoebus.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

#!/bin/bash

# A launcher for the phoebus container that allows X11 forwarding

thisdir=$(realpath $(dirname ${BASH_SOURCE[0]}))

if [[ $(docker --version 2>/dev/null) == *Docker* ]]; then
docker=docker
else
docker=podman
args="--security-opt=label=type:container_runtime_t"
fi

XSOCK=/tmp/.X11-unix # X11 socket (but we mount the whole of tmp)
XAUTH=/tmp/.container.xauth.$USER
touch $XAUTH
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
chmod 777 $XAUTH

x11="
-e DISPLAY
-v $XAUTH:$XAUTH
-e XAUTHORITY=$XAUTH
--net host
"

args=${args}"
-it
"

export MYHOME=/home/${USER}
mounts="
-v=/tmp:/tmp
-v=${MYHOME}/.ssh:/root/.ssh
"

set -x
$docker run ${mounts} ${args} ${x11} ghcr.io/epics-containers/ec-phoebus:latest

0 comments on commit 6e16c51

Please sign in to comment.