Skip to content

Commit

Permalink
chore(ci): Update docker file to use environment variable properly
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenixpereira committed Jun 5, 2024
1 parent a9a7aea commit 209a9af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Production

on:
push:
branches: [main, ci-aws] # Remove ci-aws after testing
branches: [main]

env:
AWS_REGION: ap-southeast-2
Expand Down
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ WORKDIR /app
# Install dependencies
COPY pyproject.toml poetry.lock ./

RUN pip install poetry \
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) \
&& echo "Guild ID: $GUILD_ID" \
&& pip install poetry \
&& poetry config virtualenvs.create false \
&& poetry install --no-dev

# Copy the rest of the application code
COPY . .

# Define environment variables from secrets
RUN echo "GUILD_ID=$(cat /run/secrets/GUILD_ID)" >> /etc/environment \
&& echo "BOT_TOKEN=$(cat /run/secrets/BOT_TOKEN)" >> /etc/environment

# Run the bot
CMD ["poetry", "run", "python", "src/main.py"]

0 comments on commit 209a9af

Please sign in to comment.