Tanishq Dubey
905e3c3977
All checks were successful
Docker Build and Publish / build (push) Successful in 6s
63 lines
1.5 KiB
Makefile
63 lines
1.5 KiB
Makefile
.PHONY: build run clean run-docker stop-docker logs-docker
|
|
|
|
# Docker image details
|
|
IMAGE_NAME = git.dws.rip/dubey/spectra
|
|
TAG = main
|
|
|
|
# Local development settings
|
|
PYTHON = python3
|
|
PIP = pip3
|
|
PORT = 5000
|
|
|
|
build:
|
|
docker build -t $(IMAGE_NAME):$(TAG) .
|
|
|
|
run:
|
|
$(PYTHON) app.py
|
|
|
|
install:
|
|
$(PIP) install -r requirements.txt
|
|
|
|
clean:
|
|
find . -type d -name "__pycache__" -exec rm -r {} +
|
|
find . -type f -name "*.pyc" -delete
|
|
rm -rf thumbnails/*
|
|
rm -rf uploads/*
|
|
|
|
run-docker:
|
|
docker run -d \
|
|
--name spectra \
|
|
-p $(PORT):5000 \
|
|
-v $(PWD)/uploads:/app/uploads \
|
|
-v $(PWD)/thumbnails:/app/thumbnails \
|
|
-v $(PWD)/photos.db:/app/photos.db \
|
|
$(IMAGE_NAME):$(TAG)
|
|
|
|
run-docker-attached:
|
|
docker run -it \
|
|
--name spectra \
|
|
-p $(PORT):5000 \
|
|
-v $(PWD)/uploads:/app/uploads \
|
|
-v $(PWD)/thumbnails:/app/thumbnails \
|
|
-v $(PWD)/photos.db:/app/photos.db \
|
|
$(IMAGE_NAME):$(TAG)
|
|
|
|
stop-docker:
|
|
docker stop spectra
|
|
docker rm spectra
|
|
|
|
logs-docker:
|
|
docker logs -f spectra
|
|
|
|
rebuild: clean build run-docker
|
|
|
|
help:
|
|
@echo "Available commands:"
|
|
@echo " make build - Build Docker image"
|
|
@echo " make run - Run locally using Python"
|
|
@echo " make install - Install Python dependencies"
|
|
@echo " make clean - Remove cache files and generated content"
|
|
@echo " make run-docker - Run in Docker container"
|
|
@echo " make stop-docker - Stop and remove Docker container"
|
|
@echo " make logs-docker - View Docker container logs"
|
|
@echo " make rebuild - Clean, rebuild and run Docker container"
|