From 13fd61b57188d4e78f2475bfdb403d4b58ea3b22 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 10 Jun 2026 12:59:28 +0900 Subject: [PATCH] Bake data files into Docker image --- .dockerignore | 3 ++- DOCKER.md | 16 ++++++++++------ Dockerfile | 4 +++- docker-compose.yml | 1 - 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.dockerignore b/.dockerignore index 804a97e..8662a7b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -16,11 +16,12 @@ __pycache__/ .pytest_cache/ .mypy_cache/ -data/ backend/instance/ *.log *.zip *.XLSM *.xlsx +!data/**/*.XLSM +!data/**/*.xlsx sam.txt diff --git a/DOCKER.md b/DOCKER.md index af0d9f6..c282ef2 100644 --- a/DOCKER.md +++ b/DOCKER.md @@ -40,7 +40,6 @@ docker run --rm --network host ` -e FLASK_PORT=6050 ` -e APP_DATA_DIR=/app/data ` -e AUTO_BOOTSTRAP_DB=true ` - -v ${PWD}/data:/app/data ` -v ${PWD}/backend/instance:/app/backend/instance ` gitea.mouse84.com/kim.kanghee/idrac-info:latest ``` @@ -80,15 +79,18 @@ docker compose logs -f idrac-info ## Persistent Data -The compose file mounts local directories into the container: +The image includes the committed `data` directory, including scripts and +server-list files, so the default compose file does not mount `./data` over +`/app/data`. + +The compose file only mounts the Flask instance directory: ```text -./data -> /app/data ./backend/instance -> /app/backend/instance ``` -This preserves uploads, generated files, logs, backups, scripts, repositories, -and the default SQLite database across container rebuilds. +This preserves the default SQLite database and other instance files across +container restarts. ## Environment @@ -119,11 +121,13 @@ TELEGRAM_CHAT_ID= ## Notes The image is based on Ubuntu 24.04 and installs Dell iDRAC Tools from the local -`iDRACTools` directory during image build: +`iDRACTools` directory during image build. It also copies the committed `data` +directory into `/app/data` during image build: ```text iDRACTools/racadm/UBUNTU24/x86_64/*.deb iDRACTools/ipmitool/UBUNTU24_x86_64/*.deb +data/ -> /app/data ``` `racadm` is expected on: diff --git a/Dockerfile b/Dockerfile index 13bb90c..1665f8b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -54,8 +54,10 @@ RUN pip install --upgrade pip \ COPY app.py config.py ./ COPY backend ./backend COPY migrations ./migrations +COPY data ./data -RUN mkdir -p /app/data /app/backend/instance +RUN mkdir -p /app/data /app/backend/instance \ + && find /app/data -type f \( -name "*.sh" -o -name "*.py" \) -exec chmod +x {} \; EXPOSE 6050 diff --git a/docker-compose.yml b/docker-compose.yml index a4fc0b4..7623da0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,6 +19,5 @@ services: TELEGRAM_BOT_TOKEN: "${TELEGRAM_BOT_TOKEN:-}" TELEGRAM_CHAT_ID: "${TELEGRAM_CHAT_ID:-}" volumes: - - ./data:/app/data - ./backend/instance:/app/backend/instance restart: unless-stopped