diff --git a/dockerfile b/dockerfile index 43118bf..8031a6e 100755 --- a/dockerfile +++ b/dockerfile @@ -1,13 +1,14 @@ -FROM python:3.12-alpine +FROM python:3.12-slim LABEL org.opencontainers.image.authors="geirawsm@pm.me" WORKDIR / -COPY . ./app/ +COPY / /app/ WORKDIR /app/ RUN pip install --upgrade pip RUN pip install pipenv +RUN pipenv install --system --deploy --ignore-pipfile VOLUME [ "/data" ] @@ -23,7 +24,6 @@ RUN echo -e \ "\"LAST_RUN_NUMBER\": \"${LAST_RUN_NUMBER}\"}"\ > /app/sausage_bot/version.json -RUN pipenv install --system --deploy --ignore-pipfile # Run bot -CMD ["python", "-m", "sausage_bot", "--log", "--log-print", "--log-error", "--log-database", "--debug", "--log-file", "--data-dir", "/data"] +ENTRYPOINT [ "python", "-m", "sausage_bot", "--log-all", "--data-dir", "/data" ] \ No newline at end of file diff --git a/sausage_bot/util/config.py b/sausage_bot/util/config.py index 660442c..3dcdc89 100755 --- a/sausage_bot/util/config.py +++ b/sausage_bot/util/config.py @@ -60,11 +60,11 @@ def ensure_folder(folder_path: str): try: env = Env() - env.read_env(envs.env_file) + env.read_env(path=envs.env_file) # Set basic env values - DISCORD_TOKEN = env('DISCORD_TOKEN') - DISCORD_GUILD = env('DISCORD_GUILD') - BOT_ID = env('BOT_ID') + DISCORD_TOKEN = env('DISCORD_TOKEN', default=None) + DISCORD_GUILD = env('DISCORD_GUILD', default=None) + BOT_ID = env('BOT_ID', default=None) PREFIX = env('PREFIX', default='!') BOT_CHANNEL = env('BOT_DUMP_CHANNEL', default='bot-log') TIMEZONE = env('TIMEZONE', default='Europe/Oslo') @@ -72,16 +72,13 @@ def ensure_folder(folder_path: str): ROLE_CHANNEL = env('ROLE_CHANNEL', default='roles') SPOTIFY_ID = env('SPOTIFY_ID', default=None) SPOTIFY_SECRET = env('SPOTIFY_SECRET', default=None) - if any(len(envvar) <= 0 for envvar in [ - DISCORD_GUILD, BOT_ID, DISCORD_TOKEN + if any(envvar is None for envvar in [ + DISCORD_TOKEN, DISCORD_GUILD, BOT_ID ]): print('Something is wrong with the env file.') exit() except EnvError as e: - print(env.dump()) - print( - f'You need to set environment variables for the bot to work: {e}' - ) + print(f'You need to set environment variables for the bot to work: {e}') exit() try: