Skip to content

Commit 0754a08

Browse files
committed
Add initial setup to generate images
1 parent 9ecc328 commit 0754a08

11 files changed

+494
-2
lines changed

1.gocd.yml

Whitespace-only changes.

Makefile

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
.PHONY: help all clean build build-all maintainer-clean install-dep uninstall-dep
2+
.PHONY: installcheck uninstallcheck test test-all
3+
4+
OWNER:=ucphhpc
5+
TAG:=edge
6+
PACKAGE_TIMEOUT:=60
7+
ALL_IMAGES:=base-sif
8+
9+
all: venv install-dep init help
10+
11+
# Inspired by https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
12+
help:
13+
@echo "sif-images"
14+
@echo "========================="
15+
@echo "Replace % with a image directory name (e.g., make build/sif-image)"
16+
@echo
17+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
18+
19+
init:
20+
. $(VENV)/activate; python3 init-images.py
21+
22+
clean:
23+
rm -fr .env
24+
rm -fr .pytest_cache
25+
rm -fr tests/__pycache__
26+
27+
build/%:
28+
29+
30+
build-all: $(foreach i,$(ALL_IMAGES),build/$(i))
31+
32+
maintainer-clean:
33+
@echo 'This command is intended for maintainers to use; it'
34+
@echo 'deletes files that may need special tools to rebuild.'
35+
$(MAKE) venv-clean
36+
$(MAKE) clean
37+
38+
install-dev:
39+
$(VENV)/pip install -r requirements-dev.txt
40+
41+
install-dep:
42+
$(VENV)/pip install -r requirements.txt
43+
44+
uninstall-dep:
45+
$(VENV)/pip uninstall -r requirements.txt
46+
47+
include Makefile.venv

Makefile.venv

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
VENV_NAME=venv
2+
VENV=$(VENV_NAME)/bin
3+
ACTIVATE_FILE=$(VENV)/activate
4+
PYTHON=$(VENV)/python3
5+
6+
#
7+
# Interactive shells
8+
#
9+
10+
.PHONY: python
11+
python: venv
12+
exec $(VENV)/python
13+
14+
.PHONY: ipython
15+
ipython: $(VENV)/ipython
16+
exec $(VENV)/ipython
17+
18+
.PHONY: shell
19+
shell: venv
20+
. $(VENV)/activate && exec $(notdir $(SHELL))
21+
22+
.PHONY: bash zsh
23+
bash zsh: venv
24+
. $(VENV)/activate && exec $@
25+
26+
#
27+
# Python interpreter detection
28+
#
29+
30+
_PY_AUTODETECT_MSG=Detected Python interpreter: $(PY). Use PY environment variable to override
31+
32+
ifeq (ok,$(shell test -e /dev/null 2>&1 && echo ok))
33+
NULL_STDERR=2>/dev/null
34+
else
35+
NULL_STDERR=2>NUL
36+
endif
37+
38+
ifndef PY
39+
_PY_OPTION:=python3
40+
ifeq (ok,$(shell $(_PY_OPTION) -c "print('ok')" $(NULL_STDERR)))
41+
PY=$(_PY_OPTION)
42+
endif
43+
endif
44+
45+
ifndef PY
46+
_PY_OPTION:=$(VENVDIR)/bin/python
47+
ifeq (ok,$(shell $(_PY_OPTION) -c "print('ok')" $(NULL_STDERR)))
48+
PY=$(_PY_OPTION)
49+
$(info $(_PY_AUTODETECT_MSG))
50+
endif
51+
endif
52+
53+
ifndef PY
54+
_PY_OPTION:=python
55+
ifeq (ok,$(shell $(_PY_OPTION) -c "print('ok')" $(NULL_STDERR)))
56+
PY=$(_PY_OPTION)
57+
$(info $(_PY_AUTODETECT_MSG))
58+
endif
59+
endif
60+
61+
ifndef PY
62+
define _PY_AUTODETECT_ERR
63+
Could not detect Python interpreter automatically.
64+
Please specify path to interpreter via PY environment variable.
65+
endef
66+
$(error $(_PY_AUTODETECT_ERR))
67+
endif
68+
69+
#
70+
# Virtual environment
71+
#
72+
73+
.PHONY: venv
74+
venv:
75+
$(PY) -m venv $(VENV_NAME)
76+
$(VENV)/python -m pip install --upgrade pip setuptools wheel
77+
78+
.PHONY: venv-clean
79+
venv-clean:
80+
rm -fr $(VENV_NAME)

README.md

-2
This file was deleted.

README.rst

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
==========
2+
sif-images
3+
==========
4+
5+
This repository holds the configurations for the SIF compute virtual machine images
6+
that is used for the VMs that hosts the users Jupyter Notebook Containers.
7+
8+

architecture.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
owner: ucphhpc
2+
architecture:
3+
base-image:
4+
latest:

0 commit comments

Comments
 (0)