Skip to content

Commit

Permalink
add Dockerfile and README to template
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed Oct 10, 2023
1 parent 665d94e commit 973592c
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 14 deletions.
34 changes: 23 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,41 @@
##### build stage ##############################################################

ARG TARGET_ARCHITECTURE
ARG BASE=7.0.7ec2
ARG REGISTRY=ghcr.io/epics-containers

##### build stage ##############################################################

FROM ${REGISTRY}/epics-base-${TARGET_ARCHITECTURE}-developer:${BASE} AS developer

# get latest ibek while under dev. In future the epics-base version will be used
# Get latest ibek while in development. Will come from epics-base in future.
RUN pip install --upgrade ibek

# the devcontainer mounts the project root to /epics/ioc-template
WORKDIR /epics/ioc-template/ibek-support
# The devcontainer mounts the project root to /epics/ioc-adsimdetector. Using
# the same location here makes devcontainer/runtime differences transparent.
WORKDIR /epics/ioc-adsimdetector/ibek-support

# copy the global ibek files
COPY ibek-support/_global/ _global

COPY ibek-support/iocStats/ iocStats
RUN iocStats/install.sh 3.1.16

################################################################################
# TODO - Add futher support module installations here
################################################################################
COPY ibek-support/asyn/ asyn/
RUN asyn/install.sh R4-42

COPY ibek-support/autosave/ autosave/
RUN autosave/install.sh R5-10-2

COPY ibek-support/busy/ busy/
RUN busy/install.sh R1-7-3

COPY ibek-support/ADCore/ ADCore/
RUN ADCore/install.sh R3-12-1

COPY ibek-support/ADSimDetector/ ADSimDetector/
RUN ADSimDetector/install.sh R2-10

# create IOC source tree / generate Makefile / compile
RUN ibek ioc compile
# Generate template IOC source tree / generate Makefile / compile
RUN ibek ioc build

##### runtime preparation stage ################################################

Expand All @@ -44,4 +56,4 @@ RUN ibek support apt-install --runtime

ENV TARGET_ARCHITECTURE ${TARGET_ARCHITECTURE}

ENTRYPOINT ["/bin/bash", "-c", "${IOC}/start.sh"]
ENTRYPOINT ["/bin/bash", "-c", "${IOC}/start.sh"]
58 changes: 55 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,58 @@
An epics-containers generic IOC source file.
ADSimDetector Generic IOC for epics-containers
==============================================

Generates a Generic IOC for running in a container.
Creates a generic IOC for ADSimDetector using GitHub Actions and
IOC Builder for EPICS and Kubernetes (ibek).

See the https://epics-containers.github.io
The Generic IOC built by CI is published to
[Github Packages](https://github.com/orgs/epics-containers/packages?repo_name=ioc-adsimdetector).

The registry provides a runtime
image for deploying to production and a dev image for testing,
debugging and developing new features. epics-containers implements
tools to launch IOCs in a Kubernetes cluster. But any container
runtime can be used to launch an IOC instance by mounting configuration
files into the container.

## Launching an IOC instance

The Generic IOC can be launched as an IOC instance. To do this a
container runtime should load the above runtime image and mount
instance configuration files into the folder `/epics/ioc/config`.

Options for the configuration files are:-

- ioc.yaml:
- If the config folder contains an ioc.yaml file we invoke the ibek tool to
generate the startup script and database. Then launch with the generated
startup script.

- st.cmd + ioc.subst:
- If the config folder contains a st.cmd script and a ioc.subst file then
optionally generate ioc.db from the ioc.subst file and use the st.cmd script
as the IOC startup script. Note that the expanded database file will
be generated in /tmp/ioc.db

- start.sh:
- If the config folder contains a start.sh script it will be executed.
This allows the instance implementer to provide a completely custom
startup script.

- no mount:
- If the config folder is empty then this Generic IOC will launch the
example IOC instance

## Related projects

- [ibek](https://github.com/epics-containers/ibek) builds generic IOCs and
IOC instances.
- [ibek-support](https://github.com/epics-containers/ibek-support) tells ibek
how each EPICS support module is built.
- [epics containers documentation](https://epics-containers.github.io/)
explanations and tutorials for epics-containers.
- [epics-base](https://github.com/epics-containers/epics-base) the EPICS base
container image upon which all Generic IOCs are built.
- [epics-containers-cli](https://github.com/epics-containers-cli) a command
line tool to assist with building and deploying epics-containers into
Kubernetes.

0 comments on commit 973592c

Please sign in to comment.