Makefile (view raw)
1# Variables
2IMAGE_NAME=albus
3REQUIREMENTS=requirements.txt
4ENV_FILE=.env
5
6.PHONY: all clean build
7
8all: build
9
10# Export requirements using Poetry
11$(REQUIREMENTS): pyproject.toml poetry.lock
12 poetry export -f requirements.txt --output $(REQUIREMENTS) --without-hashes
13
14# Build the Docker image
15build: $(REQUIREMENTS)
16 docker build -t $(IMAGE_NAME) .
17
18# Clean up the requirements.txt file
19clean:
20 rm -f $(REQUIREMENTS)
21
22# Utility target to run the Docker container
23run: $(ENV_FILE)
24 docker-compose up -d