Refactor Dockerfile to use Python 3.11-slim

This commit is contained in:
2024-09-24 22:50:43 +09:00
parent 9dde702e85
commit 19c2ddc6f5
8 changed files with 60 additions and 53 deletions

View File

@@ -1,41 +1,25 @@
IMAGE_NAME = "cloudflare-ddns"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
default: build
.DEFAULT_GOAL := help
.PHONY: build
build: stop
docker build -t $(IMAGE_NAME) .
.PHONY: run
run:
docker run --rm --privileged=true -d -v /opt/cloudflare-ddns/config:/app/cloudflare-ddns/config $(IMAGE_NAME)
.PHONY: stop
stop:
@container_id=$$(docker ps -q -f ancestor=$(IMAGE_NAME)); \
if [ -n "$$container_id" ]; then \
echo "Stopping container $$container_id"; \
docker stop $$container_id; \
else \
echo "No running container found for image $(IMAGE_NAME)"; \
fi
.PHONY: help
help:
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@echo " install Install the required dependencies"
@echo " certbot Install certbot"
@echo " uninstall Uninstall the installed dependencies"
@echo ""
.PHONY: install
install:
@echo "Installing cloudflare-ddns"
@scripts/install.sh
.PHONY: certbot
certbot:
@echo "Installing certbot"
@scripts/certbot.sh
.PHONY: clean
clean:
@rm -rf /app/cloudflare-ddns
@rm -rf /app/certbot
@rm /etc/cron.d/cloudflare-ddns
@rm /var/log/cloudflare_ddns.log
@rm /var/log/cloudflare_ddns.log.*
@echo "Done"
.PHONY: uninstall
uninstall:
@scripts/uninstall.sh