-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: improve overall repo [2] (#30)
- Loading branch information
1 parent
2e487a9
commit bebd52f
Showing
16 changed files
with
199 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,32 @@ | ||
## Description | ||
## Proposed changes ⤴️ | ||
|
||
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. | ||
Describe the big picture of your changes, add relevant motivation and context. | ||
|
||
Fixes # (issue) | ||
**If it fixes a bug or resolves a feature request, please link a corresponding issue:** | ||
Fixes # | ||
|
||
## Type of change | ||
## Types of changes 🔧 | ||
|
||
Please delete options that are not relevant. | ||
What type of changes does your code introduce to the project? | ||
|
||
- [ ] Bug fix (non-breaking change which fixes an issue) | ||
- [ ] Bugfix (non-breaking change which fixes an issue) | ||
- [ ] New feature (non-breaking change which adds functionality) | ||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) | ||
- [ ] Documentation updated | ||
- [ ] Other | ||
|
||
## Checklist: | ||
## Checklist ✅ | ||
|
||
- [ ] My code follows the style guidelines of this project | ||
- [ ] I have performed a self-review of my own code | ||
- [ ] I have commented my code, particularly in hard-to-understand areas | ||
- [ ] My changes generate no new warnings | ||
- [ ] I have added tests that prove my fix is effective or that my feature works | ||
- [ ] New and existing unit tests pass locally with my changes | ||
- [ ] I have not reduced the existing code coverage | ||
If you're unsure about any of those below, ask explicitly. | ||
This is simply a reminder of what needs to be checked before merging your code. | ||
|
||
- [ ] I have read the [CONTRIBUTING](https://github.com/AngryMaciek/angry-moran-simulator/blob/master/CONTRIBUTING.md). | ||
- [ ] I have performed a self-review of my own code. | ||
- [ ] Tests specified with the 'make' framework do not raise any errors. | ||
- [ ] I have added tests that prove my fix is effective or that my feature works. | ||
- [ ] I have added necessary documentation (if appropriate). | ||
- [ ] My changes generate no new warnings. | ||
- [ ] I have commented my code, particularly in hard-to-understand areas. | ||
|
||
## Further comments 🧠 | ||
|
||
If this is a relatively large or complex change feel free to provide additional information or explanation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: development container tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
devcontainer: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
|
||
- name: Check out source repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build Docker image | ||
run: docker build -t moranpycess:latest -f Dockerfile . | ||
|
||
# non-interactive shell needs to initialise & activate conda in a different way than -it | ||
# ~AngryMaciek | ||
- name: make help | ||
run: | | ||
docker run --name moranpycess -v /home/runner/work/angry-moran-simulator/angry-moran-simulator:/moranpycess moranpycess /bin/bash -c "source /mambaforge/etc/profile.d/conda.sh && conda activate moranpycess-dev && make" | ||
docker rm moranpycess | ||
# Dockerception is not advised (running Docker in a Docker, dind) | ||
# https://stackoverflow.com/a/33003273/2340598 | ||
# | ||
# While running the ci (github actions) we already start a container | ||
# for each workflow; then above we build another container and would | ||
# execute commands inside it. This is not a good practice. | ||
# In the CI issues arise related to file permissions on the mounted | ||
# volume (the moranpycess source code). Therefore we will only test | ||
# "make help", not all commands of the Makefile. | ||
# Development from the container has been tested locally and the | ||
# commands are functional. | ||
# By the way: I don't expect many developers would insist on contributing | ||
# from a container anyway... | ||
# ~AngryMaciek |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
cff-version: "1.2.0" | ||
authors: | ||
- family-names: Bak | ||
given-names: Maciek | ||
orcid: "https://orcid.org/0000-0003-1361-7301" | ||
- family-names: Rozlach | ||
given-names: Anna M. | ||
orcid: "https://orcid.org/0000-0002-5195-4299" | ||
doi: 10.5281/zenodo.4114143 | ||
message: If you use this software, please cite our article in the | ||
Journal of Open Source Software. | ||
preferred-citation: | ||
authors: | ||
- family-names: Bak | ||
given-names: Maciek | ||
orcid: "https://orcid.org/0000-0003-1361-7301" | ||
- family-names: Rozlach | ||
given-names: Anna M. | ||
orcid: "https://orcid.org/0000-0002-5195-4299" | ||
date-published: 2020-10-26 | ||
doi: 10.21105/joss.02643 | ||
issn: 2475-9066 | ||
issue: 54 | ||
journal: Journal of Open Source Software | ||
publisher: | ||
name: Open Journals | ||
start: 2643 | ||
title: "Moran Pycess: a Python package to simulate Moran processes | ||
driven by game theory" | ||
type: article | ||
url: "https://joss.theoj.org/papers/10.21105/joss.02643" | ||
volume: 5 | ||
title: "Moran Pycess: a Python package to simulate Moran processes | ||
driven by game theory" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,65 @@ | ||
# | ||
# Good references: | ||
# https://denibertovic.com/posts/handling-permissions-with-docker-volumes/ | ||
# https://askubuntu.com/questions/1457726/how-and-where-to-install-conda-to-be-accessible-to-all-users | ||
# https://www.fromlatest.io | ||
# | ||
# ~AngryMaciek | ||
|
||
##### BASE IMAGE ##### | ||
FROM python:3.7.4-slim | ||
FROM bitnami/minideb:bullseye | ||
# INFO: https://github.com/bitnami/minideb | ||
|
||
##### METADATA ##### | ||
LABEL base.image="python:3.7.4-slim" | ||
LABEL base.image="bitnami/minideb:bullseye" | ||
LABEL version="2.0.0" | ||
LABEL software="moranpycess" | ||
LABEL software.description="Python framework for Moran Processes driven by game theory" | ||
LABEL software.website="https://github.com/AngryMaciek/angry-moran-simulator" | ||
LABEL software.documentation="https://github.com/AngryMaciek/angry-moran-simulator" | ||
LABEL software.license="https://github.com/AngryMaciek/angry-moran-simulator/blob/master/LICENSE" | ||
LABEL software.website="https://github.com/AngryMaciek/angry-moran-simulator" | ||
LABEL software.license="MIT" | ||
LABEL software.tags="Bioinformatcs" | ||
LABEL maintainer="[email protected]" | ||
LABEL maintainer="Maciek Bak" | ||
LABEL maintainer.email="[email protected]" | ||
|
||
##### INSTALL SYSTEM-LEVEL DEPENDENCIES ##### | ||
RUN install_packages curl ca-certificates gnupg2 git gosu | ||
|
||
##### DEFINE BUILD VARIABLES ##### | ||
ARG MAMBADIR="/mambaforge" | ||
ARG CONDABINDIR="/mambaforge/bin" | ||
ARG MAMBAURL="https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh" | ||
|
||
##### SET ENVIROMENTAL VARIABLES ##### | ||
ENV LANG C.UTF-8 | ||
|
||
##### PREPARE WORKING DIRECTORY ##### | ||
VOLUME /moranpycess | ||
WORKDIR /moranpycess | ||
|
||
##### INSTALL MAMBAFORGE ##### | ||
RUN /bin/bash -c "curl -L ${MAMBAURL} > mambaforge.sh \ | ||
&& bash mambaforge.sh -b -p ${MAMBADIR} \ | ||
&& ${CONDABINDIR}/conda config --system --set channel_priority strict \ | ||
&& source ${CONDABINDIR}/activate \ | ||
&& conda init bash \ | ||
&& rm -f mambaforge.sh" | ||
|
||
##### BUILD DEV ENV ##### | ||
COPY environment.yml . | ||
RUN /bin/bash -c "${CONDABINDIR}/mamba install conda-build boa conda-verify -c conda-forge --yes \ | ||
&& ${CONDABINDIR}/mamba env create --file environment.yml \ | ||
&& ${CONDABINDIR}/conda clean --all --yes \ | ||
&& rm -f environment.yml" | ||
|
||
##### COPY REPOSITORY ##### | ||
WORKDIR /usr/src/moranpycess | ||
COPY . . | ||
##### EXPOSE PORTS ##### | ||
EXPOSE 8888 | ||
|
||
##### INSTALL AND TEST-IMPORT ##### | ||
RUN pip install --upgrade pip \ | ||
&& python -m pip install . \ | ||
&& python -c 'import moranpycess' | ||
##### SETUP ENTRYPOINT ##### | ||
COPY entrypoint.sh /bin/entrypoint.sh | ||
RUN /bin/bash -c "chmod +x /bin/entrypoint.sh \ | ||
&& groupadd conda \ | ||
&& chgrp -R conda ${MAMBADIR} \ | ||
&& chmod 770 -R ${MAMBADIR}" | ||
ENTRYPOINT ["/bin/entrypoint.sh"] | ||
CMD ["/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
# create a non-root user "user" passed from the command line (or fallback); | ||
# set shell, home, conda group, init conda; | ||
# exec the rest (CMD) as "user" | ||
# ~AngryMaciek | ||
|
||
ID=${HOSTUID:-9001} | ||
useradd --shell /bin/bash -u $ID -o -c "" -m user | ||
export HOME=/home/user | ||
adduser user conda &> /dev/null | ||
/usr/sbin/gosu user /bin/bash -c "/mambaforge/bin/conda init bash &> /dev/null" | ||
exec /usr/sbin/gosu user "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.