Skip to content

Commit

Permalink
chore(ci): Update docker file to set environment variable at runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenixpereira committed Jun 5, 2024
1 parent 78941b8 commit e1808b2
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

0 comments on commit e1808b2

Please sign in to comment.