Skip to content

Commit

Permalink
deploy: add build using epics-in-docker musl image.
Browse files Browse the repository at this point in the history
musl allows us to produce a fully static binary, which can be deployed
on almost any machine.

The intended deployment directory is /opt/rffe-epics-ioc, so that's
where we build the IOC, to guarantee that envPaths has the correct
definitions.
  • Loading branch information
ericonr committed Aug 28, 2024
1 parent 9717ab2 commit 92f9d37
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
32 changes: 32 additions & 0 deletions build-ioc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh

set -ex

cp /opt/epics/RELEASE configure/
cat << EOF > configure/CONFIG_SITE.local
STATIC_BUILD=YES
FULL_STATIC_BUILD=YES
USR_LDFLAGS = -static-pie
# TODO: add to base image
COMMANDLINE_LIBRARY = READLINE_NCURSES
EOF

# TODO: add to base image
apk add git ncurses-static

git config --global --add safe.directory $PWD

make distclean
make
make clean
make -C iocBoot

version=$(git describe)

echo $version > rffe-epics-ioc-version
echo ".git/" > /tmp/globs
# this trick is done so the resulting tarball has a root rffe-epics-ioc/ directory
(cd .. && tar caf rffe-epics-ioc/rffe-epics-ioc-${version}.tar.gz -X /tmp/globs rffe-epics-ioc/)
rm rffe-epics-ioc-version

make distclean
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
build-static-ioc:
image: ghcr.io/cnpem/lnls-alpine-3.18-epics-7:v0.10.0-dev
volumes:
- type: bind
source: ./
target: /opt/rffe-epics-ioc
working_dir: /opt/rffe-epics-ioc
command: ./build-ioc.sh

0 comments on commit 92f9d37

Please sign in to comment.