# Fix bug

This commit is contained in:
yshtcn 2024-06-04 00:31:10 +08:00
parent aba948bc2b
commit a8bb275cf4
2 changed files with 11 additions and 12 deletions

View File

@ -129,8 +129,8 @@ def load_ip_records(ip_record_file):
def main():
try:
# 加载配置文件
config_path = os.environ.get('CONFIG_PATH', '/config/config.json')
sample_config_path = os.environ.get('SAMPLE_CONFIG_PATH', '/config/config.sample.json')
config_path = os.environ.get('CONFIG_PATH', '/app/config/config.json')
sample_config_path = os.environ.get('SAMPLE_CONFIG_PATH', '/app/config.sample.json')
config = load_config(config_path, sample_config_path)
ACCESS_KEY_ID = config['ACCESS_KEY_ID']
@ -141,7 +141,7 @@ def main():
GETIP_URLS = config['GETIP_URLS']
PORTS = config['PORTS']
PRIORITY = config.get('PRIORITY', 1)
IP_RECORD_FILE = config.get('IP_RECORD_FILE', '/logs/ip_records.json')
IP_RECORD_FILE = config.get('IP_RECORD_FILE', '/app/config/' + config.get('IP_RECORD_FILE', 'ip_records.json'))
INTERVAL_SECONDS = config.get('INTERVAL_SECONDS', 3600)
client = AcsClient(ACCESS_KEY_ID, ACCESS_KEY_SECRET, REGION_ID)

View File

@ -1,20 +1,19 @@
# Use an official Python runtime as a parent image
FROM python:3.9-slim
FROM python:3.12-slim
# Set the working directory
WORKDIR /app
# Copy the current directory contents into the container at /app
COPY . /app
# Install any needed packages specified in requirements.txt
COPY requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt
# Copy the application files into the container
COPY AliCloudIPUpdater.py /app/
COPY config.sample.json /app/
# Create directories for config and logs
RUN mkdir /config /logs
RUN mkdir -p /app/config
# Copy the sample config file into the image
COPY config.sample.json /config/config.sample.json
# Run update_aliyun.py when the container launches
# Run AliCloudIPUpdater.py when the container launches
CMD ["python", "AliCloudIPUpdater.py"]