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,8 +1,6 @@
#!/bin/bash
# Certbot 및 Cloudflare API 도구 설치
sudo apt update
sudo apt install -y certbot python3-certbot-dns-cloudflare jq
# 필요한 변수 설정
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

View File

@@ -1,19 +1,36 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
@echo off
echo "Certbot and Cloudflare API tools installation"
sudo apt update
sudo apt install -y certbot python3-certbot-dns-cloudflare jq
echo -e "Certbot and Cloudflare API tools installation started. \n"
sudo apt -qq update
PKG_LIST=(certbot python3-certbot-dns-cloudflare jq)
for pkg in ${PKG_LIST[@]}; do
dpkg -l | grep -q $pkg
if [ $? -eq 0 ]; then
echo "$pkg is already installed."
read -p "Do you want to reinstall it? (y/N): " reinstall
reinstall=${reinstall:-n}
if [ "$reinstall" == "y" ]; then
sudo apt install --reinstall -y $pkg
fi
echo -e "\n\n"
else
echo "$pkg is not installed."
sudo apt install -y $pkg
fi
done
sudo mkdir -p /app/cloudflare-ddns
sudo cp -r $DIR/../* /app/cloudflare-ddns
if [ -f /app/cloudflare-ddns/config/env.json ]; then
read -p "Environment configuration file already exists. Do you want to overwrite it? (y/n): " overwrite
read -p "Environment configuration file already exists. Do you want to overwrite it? (y/N): " overwrite
overwrite=${overwrite:-n}
if [ "$overwrite" == "y" ]; then
sudo mv /app/cloudflare-ddns/config/env.json /app/cloudflare-ddns/config/env.json.bak
sudo cp $DIR/../config/env_example.json /app/cloudflare-ddns/config/env.json
sudo chmod 600 /app/cloudflare-ddns/config/env.json
else
echo -e "Environment configuration file is not overwritten. \n"
fi
else
sudo mkdir -p /app/cloudflare-ddns/config
@@ -21,6 +38,6 @@ else
sudo chmod 600 /app/cloudflare-ddns/config/env.json
fi
sudo cp $DIR/../cron/cronjob-ddns /etc/cron.d/cloudflare-ddns
echo "Please modify the environment configuration file and save it in the /app/cloudflare-ddns/config/env.json path."
echo -e "Please modify the environment configuration file and save it in the /app/cloudflare-ddns/config/env.json path. \n"
echo "Certbot and Cloudflare API tools installation completed."
echo -e "Certbot and Cloudflare API tools installation completed. \n"

View File

@@ -1,9 +1,5 @@
#!/bin/bash
export CLOUDFLARE_API_KEY=$API_KEY
export CLOUDFLARE_DOMAIN=$DOMAIN_NAME
export CLOUDFLARE_ZONE_ID=$ZONE_ID
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Run the script

View File

@@ -1,7 +1,18 @@
#!/bin/bash
@echo "Uninstalling Cloudflare DDNS and Certbot..."
@sudo rm -rf /app/cloudflare-ddns
@sudo rm /etc/cron.d/cloudflare-ddns
@sudo rm /var/log/cloudflare_ddns.log
@sudo rm /var/log/cloudflare_ddns.log.*
@echo "Done"
echo "Uninstalling Cloudflare DDNS and Certbot..."
read -p "Do you want to uninstall Certbot and Cloudflare API tools? (y/N): " uninstall
uninstall=${uninstall:-n}
echo -e "\n"
if [ "$uninstall" == "y" ]; then
echo "Uninstalling Certbot and Cloudflare API tools..."
sudo apt remove --purge -y certbot python3-certbot-dns-cloudflare jq
sudo rm -rf /app/cloudflare-ddns
sudo rm /etc/cron.d/cloudflare-ddns
sudo rm /var/log/cloudflare_ddns.log
sudo rm /var/log/cloudflare_ddns.log.*
echo "Done"
else
echo "Uninstallation is cancelled."
fi