Skip to content

Commit

Permalink
Add files to help setting up the situation described in PR59
Browse files Browse the repository at this point in the history
  • Loading branch information
fangohr committed Jan 11, 2024
1 parent 81b8fb7 commit cc11ae1
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 0 deletions.
26 changes: 26 additions & 0 deletions dev/issues/59/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Container to host OOMMF. Modified for solving
# issue https://github.com/fangohr/oommf/issues/59
#
FROM ubuntu:22.04

# Avoid asking for geographic data when installing tzdata.
ENV DEBIAN_FRONTEND noninteractive

# install OOMMF dependencies and git
RUN apt-get -y update && \
apt-get install -y git tk-dev tcl-dev && \
rm -rf /var/lib/apt/lists/*

# OOMMF cannot be built as root user.
RUN adduser oommfuser
RUN mkdir /io # Create working directory for mounting.
RUN chown -R oommfuser /io # Make sure it is owned by the user.
# become the oommfuser for the future
USER oommfuser

# cd into mounting directory
WORKDIR /io

# Quick sanity check (not needed)
RUN cat /etc/issue

24 changes: 24 additions & 0 deletions dev/issues/59/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
build: Dockerfile Makefile
docker build -t oommf59 .
@# oommf59 is the name of the docker image.

# use this if the container needs to be rebuilt and docker is caching too many steps in the Dockerfile
build-force: Dockerfile Makefile
docker build --no-cache -t oommf59 .

clonerepo:
@# This cloned version of the repo will be visible in the container (under /io/repo).
@# So editing of the files can be done on the host in the ~repo~ directory, and
@# building can be done inside the container
git clone https://github.com/fangohr/oommf.git repo
@# Check out right branch with the modifications (https://github.com/fangohr/oommf/pull/58)
cd repo && git fetch -a && git checkout add-configuration-for-linux-arm64

run:
docker run --rm -ti -v `pwd`:/io oommf59 bash
@# options: --rm : remove docker container when execution stops
-ti : allow terminal interaction between host and container
-v : mount the `pwd` Volume on the host to /io in the container



49 changes: 49 additions & 0 deletions dev/issues/59/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Setup linux on ARM64 using Docker
---------------------------------

- install docker and start Docker, so that `docker --version` reports a version
rather than a `command not found`.

Might work with `brew install --cask docker`

- checkout the right branch: `git checkout add-configuration-for-linux-arm64` from this oommf repository.

- build the docker image by going to this folder (`dev/issues/59`) and run `make build`

- clone the repository (again) into a subfolder in `dev/issues/59` by running
`make clonerepo`. This should checkout the right branch (again:
`add-configuration-for-linux-arm64`) so that the partially modified OOMMF
files are available. It will create a subdirectory `repo` which is the one to
experiment with. Files in this `repo` directory will be seen inside the
container but can be modified from outside the container (and are thus also
persistent across docker sessions).

- start the docker container using `make run`. We are now inside the container,
and have the repository in the subdirectory `repo`. The subdirectory
`repo/oommf` contains the normal sources. Hans would use `cd repo && make
build` to trigger the OOMMF compilation, but if you are familiar with oommf
you would probably use pimake commands in `repo/oommf`.

Example::

oommfuser@7894d7d330a4:/io/repo/oommf$ tclsh oommf.tcl +platform
OOMMF release 2.0b0
Platform Name: linux-arm64
Tcl name for OS: Linux 5.15.49-linuxkit
C++ compiler: /usr/bin/g++
Shell details ---
tclsh (running): /usr/bin/tclsh
(links to /usr/bin/tclsh8.6)
--> Version 8.6.12, 64 bit, threaded
tclsh (OOMMF): /usr/bin/tclsh8.6
--> Version 8.6.12, 64 bit, threaded
tclConfig.sh: /usr/lib/aarch64-linux-gnu/tclConfig.sh
--> Version 8.6.12
wish (OOMMF): /usr/bin/wish8.6
tkConfig.sh: /usr/lib/aarch64-linux-gnu/tkConfig.sh
--> Tk Version 8.6.12
OOMMF threads: Yes: Default thread count = 4
OOMMF API index: 20181207
Temp file directory: /tmp


0 comments on commit cc11ae1

Please sign in to comment.