Skip to content

Commit

Permalink
Added fable docker
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Dees authored and bkpoon committed Feb 24, 2025
1 parent fa61136 commit 160a660
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
39 changes: 39 additions & 0 deletions fable/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# syntax=docker/dockerfile:1.4
# use latest debian
FROM debian:sid-slim

ENV RUNLEVEL 1
ENV DEBIAN_FRONTEND noninteractive
ENV LC_ALL C.UTF-8

RUN <<EOF
#!/usr/bin/env bash
set -exo pipefail

# update OS
apt-get -y update
apt-get -y upgrade

# install cctbx
declare -ar pkgs=(
# seems to be needed
#10 70.95 Setting up dbus-system-bus-common (1.16.0-1) ...
#10 70.96 Can't locate Encode.pm in @INC (you may need to install the Encode module)
'libencode-perl'
# this is huge, qt, hdf...
'python3-cctbx'
# fable wants to compile c++
'g++'
)
apt-get -y --no-install-recommends install "${pkgs[@]}"

# run fable to check works
fable.cout --example

# docker cleanup
apt-get -y autoremove --purge
rm -rf /var/lib/apt/lists/*
EOF

# /usr/bin
ENTRYPOINT ["fable.cout"]
44 changes: 44 additions & 0 deletions fable/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

docker to run fable FORTRAN converter

# remember name of docker to build
```
export DOCK_NAME='fable-dock'
```

# build fable docker
```
docker buildx build -t ${DOCK_NAME} .
```

# run bash in fable docker
# overriding entrypoint
```
docker run -i --entrypoint /usr/bin/env -t ${DOCK_NAME} bash
```

# run fable, see help
```
docker run -it ${DOCK_NAME}
```

# run fable --example to current dir
# fable.cout and fable_cout.cpp are created
```
docker run -i -w $(pwd) --volume=$(pwd):$(pwd):rw -t ${DOCK_NAME} --example
```

# run fable on local files
# send cout to cpp file
```
declare -ar cmda=(
docker run -i -w $(pwd)
--volume=$(pwd):$(pwd):rw
-t ${DOCK_NAME}
<user fortran file>
<user fortran file>
--namespace <user namespace>
)
${cmda[@]} > <user cpp file>
```

0 comments on commit 160a660

Please sign in to comment.