Skip to content

Commit

Permalink
Fixing failed starting dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
geirawsm committed Dec 21, 2024
1 parent e5a55b7 commit 9c792af
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
8 changes: 4 additions & 4 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
FROM python:3.12-alpine
FROM python:3.12-slim
LABEL org.opencontainers.image.authors="[email protected]"

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" ]

Expand All @@ -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" ]
17 changes: 7 additions & 10 deletions sausage_bot/util/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,25 @@ 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')
LOCALE = env('LOCALE', default='nb_NO')
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:
Expand Down

0 comments on commit 9c792af

Please sign in to comment.