diff --git a/MANIFEST.in b/MANIFEST.in index bb3ec5f0..1c554fd4 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,2 @@ +# TODO: Remove and add in `pyproject.toml` include README.md diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..7cd90e6f --- /dev/null +++ b/Makefile @@ -0,0 +1,76 @@ +# TODO: Add commands to be compatible for windows +# TODO: Add commands for tesk_api + +# Define variables +PYTHON_CMD := $(shell command -v python3 2> /dev/null) +BUILDAH_CMD := $(shell command -v buildah 2> /dev/null) +DOCKER_CMD := $(shell command -v docker 2> /dev/null) +ELIXIR_CLOUD_REGISTRY := docker.io/elixircloud +DOCKER_FILE_PATH := containers + +# Define arguments +IMAGE ?= filer +TAG ?= testing + +# Default target, build image if `make` is called without any arguments +default: build + +# Create and activate virtual environment +.PHONY: venv +venv: + @if [ -x "$(PYTHON_CMD)" ]; then \ + $(PYTHON_CMD) -m venv .venv; \ + echo "Virtual environment created. To activate, run: source .venv/bin/activate"; \ + else \ + echo "Please install python3 to create virtual environment."; \ + exit 1; \ + fi + +# Remove virtual environment +.PHONY: clean-venv +clean-venv: + rm -rf .venv + +# TODO: Install package manages and change the below commands +# Install dependencies +.PHONY: install +install: + @if [ -f .venv/bin/activate ]; then \ + echo "Activating virtual environment..."; \ + pip install .; \ + else \ + echo "Virtual environment not found. Please create it first using 'make venv'."; \ + fi + +# Build image +.PHONY: build +build: + @if [ -x "$(BUILDAH_CMD)" ]; then \ + $(BUILDAH_CMD) bud \ + -t $(ELIXIR_CLOUD_REGISTRY)/tesk-core-$(IMAGE):$(TAG) \ + --format=docker \ + --no-cache \ + -f $(DOCKER_FILE_PATH)/$(IMAGE).Dockerfile; \ + elif [ -x "$(DOCKER_CMD)" ]; then \ + $(DOCKER_CMD) build \ + -t $(ELIXIR_CLOUD_REGISTRY)/tesk-core-$(IMAGE):$(TAG) \ + -f $(DOCKER_FILE_PATH)/$(IMAGE).Dockerfile .; \ + else \ + echo "Please install buildah or docker to build images."; \ + exit 1; \ + fi + +# Run image +.PHONY: run +run: + @if [ -x "$(DOCKER_CMD)" ]; then \ + $(DOCKER_CMD) run \ + -it --rm $(ELIXIR_CLOUD_REGISTRY)/tesk-core-$(IMAGE):$(TAG); \ + else \ + echo "Please install docker to run images."; \ + exit 1; \ + fi + +# Clean up built images or other generated artifacts +clean: + docker rmi $(ELIXIR_CLOUD_REGISTRY)/tesk-core-$(IMAGE):$(TAG) diff --git a/cloudbuild.yaml b/cloudbuild.yaml deleted file mode 100644 index c78069d5..00000000 --- a/cloudbuild.yaml +++ /dev/null @@ -1,6 +0,0 @@ -steps: -- name: 'gcr.io/cloud-builders/docker' - args: ['build', '-t', 'eu.gcr.io/tes-wes/taskmaster:$TAG_NAME', '-f', 'containers/taskmaster.Dockerfile', '.'] -- name: 'gcr.io/cloud-builders/docker' - args: ['build', '-t', 'eu.gcr.io/tes-wes/filer:$TAG_NAME', '-f', 'containers/filer.Dockerfile', '.'] -images: ['eu.gcr.io/tes-wes/taskmaster:$TAG_NAME', 'eu.gcr.io/tes-wes/filer:$TAG_NAME'] diff --git a/cloudbuild_testing.yaml b/cloudbuild_testing.yaml deleted file mode 100644 index fc85869a..00000000 --- a/cloudbuild_testing.yaml +++ /dev/null @@ -1,6 +0,0 @@ -steps: -- name: 'gcr.io/cloud-builders/docker' - args: ['build', '-t', 'eu.gcr.io/tes-wes/taskmaster:testing', '-f', 'containers/taskmaster.Dockerfile', '.'] -- name: 'gcr.io/cloud-builders/docker' - args: ['build', '-t', 'eu.gcr.io/tes-wes/filer:testing', '-f', 'containers/filer.Dockerfile', '.'] -images: ['eu.gcr.io/tes-wes/taskmaster:testing', 'eu.gcr.io/tes-wes/filer:testing'] diff --git a/dockerBuild b/dockerBuild deleted file mode 120000 index 32bbcf34..00000000 --- a/dockerBuild +++ /dev/null @@ -1 +0,0 @@ -scripts//dockerBuild \ No newline at end of file diff --git a/dockerRun b/dockerRun deleted file mode 120000 index a087702b..00000000 --- a/dockerRun +++ /dev/null @@ -1 +0,0 @@ -scripts//dockerRun \ No newline at end of file diff --git a/init b/init deleted file mode 100755 index 96c61f2d..00000000 --- a/init +++ /dev/null @@ -1,8 +0,0 @@ - -# Creating virtualenv -virtualenv --clear -p python2.7 .venv - -# Activating virtualenv -. .venv/bin/activate - -./install diff --git a/install b/install deleted file mode 100755 index eefa8240..00000000 --- a/install +++ /dev/null @@ -1,4 +0,0 @@ - - -pip install . - diff --git a/pytest.ini b/pytest.ini index a9d56aa8..59f43c33 100755 --- a/pytest.ini +++ b/pytest.ini @@ -1,3 +1,4 @@ +# TODO: Remove and add in `pyproject.toml` [pytest] env = FTP_USER=user diff --git a/scripts/dockerBuild b/scripts/dockerBuild deleted file mode 100755 index 6f9c3f92..00000000 --- a/scripts/dockerBuild +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# -# Usage: -# -# buildDockerImage filer or -# buildDockerImage taskmaster -# - -IMAGE=$1 - -if [ -z "$IMAGE" ]; -then - echo "Use: $0 [tag]" - exit 12 -fi - -TAG=$2 - -if [ -z "$TAG" ]; -then - TAG=testing -fi - -if command -V buildah; -then - buildah bud -t "docker.io/elixircloud/tesk-core-$IMAGE:$TAG" \ - --format=docker --no-cache \ - -f "containers/$IMAGE.Dockerfile" -else - docker build -t "docker.io/elixircloud/tesk-core-$1:$TAG" -f "containers/$1.Dockerfile" . -fi diff --git a/scripts/dockerRun b/scripts/dockerRun deleted file mode 100755 index 4bc8709b..00000000 --- a/scripts/dockerRun +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -# -# Usage: -# -# buildRun filer or -# buildRun taskmaster -# - -imageName="$1" -shift - -docker run "docker.io/elixircloud/tesk-core-$imageName:testing" "$@" diff --git a/scripts/run b/scripts/run index f7e11994..c3baaba3 100755 --- a/scripts/run +++ b/scripts/run @@ -1,3 +1,5 @@ +# TODO: Remove once API is stable and tested on cluster. +# This script can also be added to Makefile # # Usage: diff --git a/setup.cfg b/setup.cfg index 10e6d8ae..da588a86 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,4 @@ +# TODO: Remove and add in `pyproject.toml` [metadata] description-file=README.md [aliases] diff --git a/setup.py b/setup.py index b66eb91e..8b3f499f 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ +# TODO: Remove and add in `pyproject.toml` import codecs from os import path from setuptools import setup, find_packages diff --git a/taskmaster b/taskmaster index bafd8759..8523a8b8 100755 --- a/taskmaster +++ b/taskmaster @@ -1,3 +1,3 @@ - +# TODO: Add to makefile after undertanding what its doing 😕 PYTHONPATH="src" python src/tesk_core/taskmaster.py "$@"