Skip to content

Commit

Permalink
Workflow update.
Browse files Browse the repository at this point in the history
  • Loading branch information
iwatkot committed Jan 23, 2024
1 parent 3b76d81 commit 13cf616
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ jobs:
with:
context: .
push: true
tags: iwatkot/maps4fs:latest
tags: iwatkot/maps4fs:latest
build-args: |
BOT_TOKEN=${{ secrets.BOT_TOKEN }}
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
FROM python:3.11-slim-buster

ARG BOT_TOKEN
ENV BOT_TOKEN=$BOT_TOKEN

# Dependencies for opencv.
RUN apt-get update && apt-get install -y \
libgl1-mesa-dev \
Expand Down
16 changes: 8 additions & 8 deletions src/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
from logger import Logger

logger = Logger(__name__)
parent_directory = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
logger.info(f"Parent directory: {parent_directory}")
env_path = os.path.join(parent_directory, "bot.env")
logger.info(f"Environment file: {env_path}")
if not os.path.exists(env_path):
raise FileNotFoundError(f"Environment file not found: {env_path}")
load_dotenv(env_path)
working_directory = os.getcwd()
logger.info(f"Working directory: {working_directory}")
env_path = os.path.join(working_directory, "bot.env")
if os.path.exists(env_path):
load_dotenv(env_path)
token = os.getenv("BOT_TOKEN")
if not token:
raise RuntimeError("No token provided.")

logger = Logger(__name__)
bot = Bot(token=token)
Expand Down Expand Up @@ -63,7 +63,7 @@ def run(self) -> tuple[str, str]:
tuple[str, str]: Paths to the preview and the archive.
"""
gm = generate.Map(
parent_directory, self.coordinates, self.distance, self.dem_settings, logger, self.name
working_directory, self.coordinates, self.distance, self.dem_settings, logger, self.name
)
preview_path = gm.preview()
archive_path = gm.pack()
Expand Down

0 comments on commit 13cf616

Please sign in to comment.