Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 22 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,50 +1,49 @@
.ONESHELL:
.SHELLFLAGS := -c

.PHONY: run
.PHONY: uninstall
.PHONY: install
.PHONY: install-pre-commit
.PHONY: build
.PHONY: deploy

.PHONY: setup run deploy stop install uninstall build install-pre-commit

# Conda detection
detect_conda_bin := $(shell bash -c 'if [ "${CONDA_EXE} " == " " ]; then \
CONDA_EXE=$$((find /opt/conda/bin/conda || find ~/anaconda3/bin/conda || \
find /usr/local/anaconda3/bin/conda || find ~/miniconda3/bin/conda || \
find /root/miniconda/bin/conda || find ~/Anaconda3/Scripts/conda || \
find $$CONDA/bin/conda) 2>/dev/null); fi; \
if [ "${CONDA_EXE}_" == "_" ]; then \
echo "Please install Anaconda w/ Python 3.10+ first"; \
echo "See: https://www.anaconda.com/distribution/"; \
exit 1; fi; \
echo $$(dirname $${CONDA_EXE})')

CONDA_BIN := $(detect_conda_bin)

# Setup - create .env file
setup:
@./setup.sh

# Run locally (dev mode)
run:
docker compose up emqx postgres -d
uvicorn main:app --reload

uninstall:
conda env remove -n hummingbot-api -y
# Deploy with Docker
deploy:
docker compose up -d

# Stop all services
stop:
docker compose down

# Install conda environment
install:
if conda env list | grep -q '^hummingbot-api '; then \
@if conda env list | grep -q '^hummingbot-api '; then \
echo "Environment already exists."; \
else \
conda env create -f environment.yml; \
fi
conda activate hummingbot-api
$(MAKE) install-pre-commit

uninstall:
conda env remove -n hummingbot-api -y

install-pre-commit:
/bin/bash -c 'source "${CONDA_BIN}/activate" hummingbot-api && \
@/bin/bash -c 'source "${CONDA_BIN}/activate" hummingbot-api && \
if ! conda list pre-commit | grep pre-commit &> /dev/null; then \
pip install pre-commit; \
fi && pre-commit install'

# Build Docker image
build:
docker build -t hummingbot/hummingbot-api:latest .

deploy:
docker compose up -d
Loading