Skip to content

Commit

Permalink
make a lighter runtime target
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed Jul 23, 2024
1 parent 075686a commit 0628df2
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 25 deletions.
63 changes: 39 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,50 @@
# Dockerfile for EPICS OPI PHoebus
FROM ubuntu:20.04
FROM ubuntu:20.04 as common

ENV DEBIAN_FRONTEND=noninteractive
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y locales
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8
RUN apt-get update && apt-get install -y locales
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8

ENV LANG en_US.UTF-8
RUN apt-get install -y \
openjdk-11-jdk \
maven \
openjfx \
git
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/
ENV LANG en_US.UTF-8
ENV ROOT=/phoebus
ENV VERSION=4.7.3
ENV TARGET=phoebus-product/target
WORKDIR ${ROOT}

ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/
ENV ROOT=/phoebus
ENV VERSION=4.7.3
FROM common as build

RUN git clone https://github.com/ControlSystemStudio/phoebus.git \
--branch=v${VERSION} ${ROOT}
WORKDIR ${ROOT}
RUN apt-get install -y \
openjdk-11-jdk \
maven \
openjfx \
git

# CANNOT work out how to do this in a -settings settings.xml launch config - meh
RUN sed -i 's|colors_list=|colors_list=/settings/colors.list|' app/display/convert-edm/src/main/resources/edm_converter_preferences.properties
RUN git clone https://github.com/ControlSystemStudio/phoebus.git \
--branch=v${VERSION} ${ROOT}

RUN mvn -DskipTests clean install
# CANNOT work out how to do this in a -settings settings.xml launch config - meh
RUN sed -i 's|colors_list=|colors_list=/settings/colors.list|' app/display/convert-edm/src/main/resources/edm_converter_preferences.properties

RUN ln -s phoebus-product/target/product-${VERSION}.jar phoebus.jar
RUN mvn -DskipTests clean install

COPY /settings /settings
RUN ln -s ${TARGET}/product-${VERSION}.jar phoebus.jar

ENTRYPOINT ["java", "-jar", "phoebus.jar", "-settings=/settings/settings.ini", "-server", "4918", "--add-modules=ALL-SYSTEM"]
COPY /settings /settings

FROM common as runtime

RUN apt-get install -y \
openjdk-11-jre \
openjfx \
git

COPY --from=build ${TARGET}/product-${VERSION}.jar ${TARGET}/phoebus.jar
COPY --from=build ${TARGET}/lib ${ROOT}/${TARGET}/lib
COPY --from=build /settings /settings
RUN ln -s ${TARGET}/phoebus.jar phoebus.jar

ENTRYPOINT ["java", "-jar", "phoebus.jar", "-settings=/settings/settings.ini", "-server", "4918", "--add-modules=ALL-SYSTEM"]
3 changes: 2 additions & 1 deletion phoebus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ mounts="
"

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

0 comments on commit 0628df2

Please sign in to comment.