62 lines
1.5 KiB
Makefile
62 lines
1.5 KiB
Makefile
# Makefile for Fitbit to Garmin Weight Sync Docker Application
|
|
|
|
# Variables
|
|
IMAGE = fitbit-garmin-sync
|
|
DATA_DIR = data
|
|
VOLUME = -v "$(PWD)/$(DATA_DIR)":/app/data
|
|
CONTAINER_NAME = fitbit-sync
|
|
|
|
# Default target
|
|
.PHONY: help
|
|
help:
|
|
@echo "Available targets:"
|
|
@echo " build - Build the Docker image"
|
|
@echo " data - Create the data directory for persistence"
|
|
@echo " run - Run the application in scheduled sync mode (detached)"
|
|
@echo " setup - Run interactive setup for credentials"
|
|
@echo " sync - Run manual sync"
|
|
@echo " status - Check application status"
|
|
@echo " stop - Stop the running container"
|
|
@echo " clean - Stop and remove container, remove image"
|
|
@echo " help - Show this help message"
|
|
|
|
# Build the Docker image
|
|
.PHONY: build
|
|
build:
|
|
docker build -t $(IMAGE) .
|
|
|
|
# Create data directory
|
|
.PHONY: data
|
|
data:
|
|
mkdir -p $(DATA_DIR)
|
|
|
|
# Run the scheduled sync (detached)
|
|
.PHONY: run
|
|
run: build data
|
|
docker run -d --name $(CONTAINER_NAME) $(VOLUME) $(IMAGE)
|
|
|
|
# Interactive setup
|
|
.PHONY: setup
|
|
setup: build data
|
|
docker run -it --rm $(VOLUME) $(IMAGE) setup
|
|
|
|
# Manual sync
|
|
.PHONY: sync
|
|
sync: build data
|
|
docker run -it --rm $(VOLUME) $(IMAGE) sync
|
|
|
|
# Check status
|
|
.PHONY: status
|
|
status: build data
|
|
docker run -it --rm $(VOLUME) $(IMAGE) status
|
|
|
|
# Stop the running container
|
|
.PHONY: stop
|
|
stop:
|
|
docker stop $(CONTAINER_NAME) || true
|
|
docker rm $(CONTAINER_NAME) || true
|
|
|
|
# Clean up: stop container, remove image
|
|
.PHONY: clean
|
|
clean: stop
|
|
docker rmi $(IMAGE) || true
|