Skip to content
Snippets Groups Projects
Commit 5b2fd4ac authored by B13nch3n's avatar B13nch3n
Browse files

Start Docker Readme

parent 084f076f
No related branches found
No related tags found
No related merge requests found
# Exclude files from build context that are not used to build the Docker image.
# Helps speeding up a build since less files are copied.
# Only works when this directory is build context.
# Exclude all kinds of README
**/README*
# Exclude any "test*" directories & files in the individual project directories.
# Test data is not part of the Docker image. If needed, mount at run time.
**/test*
......@@ -4,5 +4,7 @@ This directory tree contains tools/ code from past modelling projects converted
Each project should come with a small README explaining the modelling project. This will help you checking if your project is of same kind.
The [`docker`](projects/docker/) directory does not host a modelling project. It keeps the set up of a [Docker](https://www.docker.com) image that can be used to run the converter tools from the various projects.
<!-- LocalWords: README
-->
ARG VERSION_OST="2.3.0"
FROM registry.scicore.unibas.ch/schwede/openstructure:${VERSION_OST}
## We need to declare ARGs again which were declared before the build stage
## (FROM directive), otherwise they won't be available in this stage.
ARG VERSION_OST
## Set up environment
ENV SRC_DIR="/tmp" \
VERSION_OST=${VERSION_OST} \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
LABEL org.openstructure.base-image="${VERSION_OST}"
LABEL maintainer="Stefan Bienert <stefan.bienert@unibas.ch>"
LABEL vendor1="Schwede Group (schwedelab.org)"
LABEL vendor2="SIB - Swiss Institute of Bioinformatics (sib.swiss)"
LABEL vendor3="Biozentrum - University of Basel (biozentrum.unibas.ch)"
## Install python-modelcif and python-ihm
COPY docker/requirements.txt ${SRC_DIR}
WORKDIR ${SRC_DIR}
RUN set -e pipefail; \
apt-get update -y; \
apt-get install -y git pip; \
pip install -r requirements.txt; \
## use the python-ihm latest
git clone https://github.com/ihmwg/python-ihm.git ihm.git; \
cd ihm.git; \
python3 setup.py build; \
python3 setup.py install; \
cd ${SRC_DIR}; \
rm -rf ${SRC_DIR}/ihm.git; \
## use python-modelcif latest
git clone https://github.com/ihmwg/python-modelcif.git modelcif.git; \
cd modelcif.git; \
python3 setup.py build; \
python3 setup.py install; \
cd ${SRC_DIR}; \
rm -rf ${SRC_DIR}/modelcif.git; \
rm -rf /var/lib/apt/lists/*; \
apt-get purge -y --auto-remove git pip gcc
## Add a dedicated user
## MMCIF_USER_ID can be used to avoid file permission issues.
ARG MMCIF_USER_ID=501
RUN adduser --system -u ${MMCIF_USER_ID} mmcif
COPY --chmod=755 docker/entrypoint.sh /
## Copy tool(s)
ARG CONVERTERSCRIPT=CoFFE-sponge-proteins/translate2modelcif.py
COPY --chmod=755 $CONVERTERSCRIPT /usr/local/bin/convert2modelcif
## Add development setup
ARG ADD_DEV
RUN set -e pipefail; \
if test xYES = x`echo ${ADD_DEV} | tr '[:lower:]' '[:upper:]'`; then \
apt-get update -y; \
apt-get install -y emacs; \
pip install pylint black; \
apt-get purge -y --auto-remove pip; \
fi
USER mmcif
ENTRYPOINT ["/entrypoint.sh"]
# LocalWords: ARG OST ARGs ENV SRC tmp PYTHONUNBUFFERED Schwede schwedelab py
# LocalWords: PYTHONDONTWRITEBYTECODE Bioinformatics sib swiss Biozentrum ihm
# LocalWords: modelcif txt WORKDIR pipefail chmod adduser mmcif ENTRYPOINT cd
# LocalWords: pylint rf entrypoint gcc CONVERTERSCRIPT CoFFE DEV xYES emacs
# LocalWords: fi
# Docker container (base) for the converter software
This directory contains all the files needed to create the base [Docker](https://www.docker.com) image used for the converter software in [`projects`](projects/).
A specific project's translation script can be executed either in an app like manner (*I.O.U. a link to the anchor here*), calling it directly from within the container, using a local copy executed by the container (*I.O.U. a link to the anchor here*), or in an interactive shell within the container (*I.O.U. a link to the anchor here*).
[[_TOC_]]
## Building & running the Docker container
This is a quick tour on how to build and run the Docker container through different scenarios. This is not a lecture on containerisation in general, nor Linux/ Unix, shell scripting or programming. But if you encounter a specific problem, feel free to ping the [MA team](https://modelarchive.org/contact).
This section describes three use cases of the Docker container (including a build-how to per use case) but starts with a short primer of what is common to all scenarios described here.
### Prerequisites
<!--
- Do single example call
- show how to loop
1. App like
- special build
- own run command
2. Local copy
- works with every build
- own run command
3. Interactive shell
- works with every build
- most complicated run bit
-->
<!--
build:
- go into repo projects dir
- execute: docker build -f docker/Dockerfile -t mmcifconverter:20220427 .
- explain how to install a dedicated converter script in the container
- mention how to change user
- mention dev stuff
- mention script is copied to a unified name for the container to work with a single entrypoint script
run interactive shell for development:
- make sure files exist: /Users/stefan/Projects/ma-converters.git/projects/pointmutations-haddock/.docker-bash-history
- execute:
docker run --rm -i -v /Users/stefan/.bash_profile:/home/mmcif/.bash_profile -v /Users/stefan/.bash_aliases:/home/mmcif/.bash_aliases -v /Users/stefan/.bashrc:/home/mmcif/.bashrc -v /Users/stefan/Projects/ma-converters.git/projects/pointmutations-haddock/.docker-bash-history:/home/mmcif/.bash_history -v /Users/stefan/Projects/ma-converters.git/:/develop -t mmcifconverter:20220427 bash
-->
<!-- LocalWords: TOC
-->
requests
ujson
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment