-
Notifications
You must be signed in to change notification settings - Fork 7
Introduce dev container Makefile #139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
692d52c
Added a makefile with what we think is reasonable
TheBlackKoala e86f4eb
remove test thingy
TheBlackKoala fc65227
Better singularity url
TheBlackKoala d057789
Merge branch 'main' into makefile
TheBlackKoala 02c33fd
Update makefile to non-privileged run
TheBlackKoala 9caa2b3
Add docs building functionality and default target
TheBlackKoala f74d087
Fix building docs
TheBlackKoala 12c95ef
Remove userid things
TheBlackKoala 5f60c3e
Comments, help and very explicit login
TheBlackKoala 455feb2
Just a bit .PHONY
TheBlackKoala 4710ec0
Enhance Makefile (#156)
joasode 68f443c
Merge branch 'main' into makefile
TheBlackKoala File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,75 @@ | ||
| CONTAINER_RUN=docker | ||
|
|
||
| TESTFLAGS= | ||
| CONTAINER_TEST_COMMAND=cd /home/ubuntu/code && uv sync --group=tests && uv run pytest | ||
| CONTAINER_DOC_COMMAND=cd /home/ubuntu/code/doc && uv sync --group docs && uv run make apidoc && uv run make relnotes && uv run make html | ||
|
|
||
|
|
||
| CONTAINER_ENTRYPOINT=--entrypoint bash | ||
| CONTAINER_INTERNAL_PYTHON_VENV=--tmpfs=/venv:exec | ||
| CONTAINER_ENVIRONMENT=--env UV_PROJECT_ENVIRONMENT=/venv | ||
| CONTAINER_VOLUME_MOUNT=-v ${PWD}:/home/ubuntu/code | ||
| CONTAINER_USER_ID=1000 | ||
| CONTAINER_SECURITY_OPTIONS=--security-opt label=disable --security-opt systempaths=unconfined --security-opt seccomp=unconfined --security-opt apparmor=unconfined | ||
| CONTAINER_OPTIONS=--rm -it --user=$(CONTAINER_USER_ID) $(CONTAINER_SECURITY_OPTIONS) $(CONTAINER_ENTRYPOINT) $(CONTAINER_INTERNAL_PYTHON_VENV) $(CONTAINER_ENVIRONMENT) $(CONTAINER_VOLUME_MOUNT) $(OPTIONAL) | ||
|
|
||
| APPTAINER_URL=ghcr.io/deic-hpc/cotainr-dev_env-apptainer-1.3.6:main | ||
| SINGULARITY_URL=ghcr.io/deic-hpc/cotainr-dev_env-singularity-ce-4.3.0:main | ||
|
|
||
| CONTAINER_URL=$(APPTAINER_URL) | ||
|
|
||
| HELP_OUTPUT=" Welcome to the cotainr makefile\n\ | ||
| This is to help you easily test cotainr\n\ | ||
| \n\ | ||
| The default way of running cotainr is by using 'make test'\n\ | ||
| We have a list of different goals defined to help out:\n\ | ||
| \n\ | ||
| help: prints this output\n\ | ||
| login: helps you login to the container registry\n\ | ||
| \n\ | ||
| Execution goals that are executed in the container\n\ | ||
| test: executes the cotainr test-suite in a container\n\ | ||
| docs: build the cotainr documentation in a container\n\ | ||
| \n\ | ||
| Environments goals that are defined before the execution goal to setup the environment\n\ | ||
| podman: changes the cotainer runner from docker to podman\n\ | ||
| singularity: changes the container to one containing singularity\n\ | ||
| apptainer: changes the container to one containing apptainer (default)\n\ | ||
| \n\ | ||
| Runtime environment flags can be provided in any order\n\ | ||
| TESTFLAGS: string that is parsed to pytest, e.g. TESTFLAGS='-k test_info.py'\n\ | ||
| " | ||
|
|
||
| .PHONY:default help podman login singularity apptainer test docs | ||
| default: test | ||
|
|
||
| help: | ||
| @echo $(HELP_OUTPUT) | ||
|
|
||
| podman: | ||
| $(eval OPTIONAL=--userns=keep-id) | ||
| $(eval CONTAINER_RUN=podman) | ||
|
|
||
| login: | ||
| @echo "For more details on how to login to the github container registry see: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry";\ | ||
| read -p "Enter Github username:" USERNAME;\ | ||
| echo "Username: "$$USERNAME;\ | ||
| read -p "Enter Github token:" CR_PAT;\ | ||
| read -p "Enter Github password:" -s PASS;\ | ||
| echo $$CR_PAT | $(CONTAINER_RUN) login ghcr.io -u $$USERNAME -p $$PASS | ||
|
|
||
| singularity: | ||
| $(eval CONTAINER_URL=$(SINGULARITY_URL)) | ||
|
|
||
| apptainer: | ||
| $(eval CONTAINER_URL=$(APPTAINER_URL)) | ||
|
|
||
| test: | ||
| $(eval CONTAINER_COMMAND="$(CONTAINER_TEST_COMMAND) $(TESTFLAGS)") | ||
| $(call execute) | ||
|
|
||
| docs: | ||
| $(eval CONTAINER_COMMAND="$(CONTAINER_DOC_COMMAND)") | ||
| $(call execute) | ||
|
|
||
| execute = $(CONTAINER_RUN) run $(CONTAINER_OPTIONS) $(CONTAINER_URL) -c $(CONTAINER_COMMAND) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.