mirror of
https://framagit.org/la-chariotte/la-chariotte.git
synced 2025-05-05 13:21:49 +02:00
38 lines
No EOL
974 B
Makefile
38 lines
No EOL
974 B
Makefile
SHELL := /bin/bash
|
|
|
|
# PYTHON
|
|
VENV_NAME := .venv
|
|
PYTHON := $(VENV_NAME)/bin/python
|
|
PIP := $(VENV_NAME)/bin/pip
|
|
REQUIREMENTS := requirements-dev.txt
|
|
|
|
# Docker
|
|
DOCKER_COMPOSE := docker-compose
|
|
DOCKER_COMPOSE_FILE := docker-compose.yml
|
|
DOCKER_DIRECTORY := dev_env
|
|
|
|
.PHONY: all venv install activate clean dev_env_start dev_env_stop
|
|
|
|
all: venv install activate
|
|
|
|
venv:
|
|
python3 -m venv $(VENV_NAME)
|
|
@echo "Activating virtual environment with 'source $(VENV_NAME)/bin/activate'. Run 'deactivate' to exit."
|
|
|
|
install: venv
|
|
@source $(VENV_NAME)/bin/activate && $(PIP) install -r $(REQUIREMENTS)
|
|
|
|
clean:
|
|
rm -rf $(VENV_NAME)
|
|
|
|
dev_env_start:
|
|
if [ ! $(DOCKER_COMPOSE)]; then \
|
|
echo "Docker Compose not installed. Please install Docker Compose."; \
|
|
exit 1; \
|
|
fi
|
|
$(DOCKER_COMPOSE) -f $(DOCKER_DIRECTORY)/$(DOCKER_COMPOSE_FILE) up -d
|
|
@echo "Running migrations..."
|
|
$(PYTHON) manage.py migrate
|
|
|
|
dev_env_stop:
|
|
$(DOCKER_COMPOSE) -f $(DOCKER_DIRECTORY)/$(DOCKER_COMPOSE_FILE) down -v
|