From e1808b281349008d7d2b580f5c614793696223ce Mon Sep 17 00:00:00 2001 From: Phoenix Isaac Pereira Date: Wed, 5 Jun 2024 20:36:13 +0930 Subject: [PATCH] chore(ci): Update docker file to set environment variable at runtime --- Dockerfile | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index c72ed1e..6e0b3aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,16 +6,15 @@ WORKDIR /app # Install dependencies COPY pyproject.toml poetry.lock ./ -RUN --mount=type=secret,id=GUILD_ID,target=/run/secrets/GUILD_ID \ - --mount=type=secret,id=BOT_TOKEN,target=/run/secrets/BOT_TOKEN \ - GUILD_ID=$(cat /run/secrets/GUILD_ID) \ - BOT_TOKEN=$(cat /run/secrets/BOT_TOKEN) \ - && pip install poetry \ +RUN pip install poetry \ && poetry config virtualenvs.create false \ && poetry install --no-dev # Copy the rest of the application code COPY . . -# Run the bot -CMD ["poetry", "run", "python", "src/main.py"] +# Set environment variables during runtime +CMD ["sh", "-c", \ + "GUILD_ID=$(cat /run/secrets/GUILD_ID) && \ + BOT_TOKEN=$(cat /run/secrets/BOT_TOKEN) && \ + poetry run python src/main.py"]