Skip to content

Commit

Permalink
feat: remove scripts and add then in one place ie Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
JaeAeich committed May 11, 2024
1 parent ffac3ef commit a56bb15
Show file tree
Hide file tree
Showing 15 changed files with 83 additions and 70 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# TODO: Remove and add in `pyproject.toml`
include README.md
76 changes: 76 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 0 additions & 6 deletions cloudbuild.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions cloudbuild_testing.yaml

This file was deleted.

1 change: 0 additions & 1 deletion dockerBuild

This file was deleted.

1 change: 0 additions & 1 deletion dockerRun

This file was deleted.

8 changes: 0 additions & 8 deletions init

This file was deleted.

4 changes: 0 additions & 4 deletions install

This file was deleted.

1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# TODO: Remove and add in `pyproject.toml`
[pytest]
env =
FTP_USER=user
Expand Down
31 changes: 0 additions & 31 deletions scripts/dockerBuild

This file was deleted.

12 changes: 0 additions & 12 deletions scripts/dockerRun

This file was deleted.

2 changes: 2 additions & 0 deletions scripts/run
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# TODO: Remove once API is stable and tested on cluster.
# This script can also be added to Makefile

#
# Usage:
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# TODO: Remove and add in `pyproject.toml`
[metadata]
description-file=README.md
[aliases]
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# TODO: Remove and add in `pyproject.toml`
import codecs
from os import path
from setuptools import setup, find_packages
Expand Down
2 changes: 1 addition & 1 deletion taskmaster
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

# TODO: Add to makefile after undertanding what its doing 😕

PYTHONPATH="src" python src/tesk_core/taskmaster.py "$@"

0 comments on commit a56bb15

Please sign in to comment.