From 9459f1f5c9fb41592ce8f25d87dff0a904116849 Mon Sep 17 00:00:00 2001 From: Phoenix Isaac Pereira Date: Wed, 5 Jun 2024 18:31:58 +0930 Subject: [PATCH] chore(ci): Update docker file to use environment variable properly --- .gitignore | 1 - Dockerfile | 9 ++++----- docker-compose.yml | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 31566e4..51387d0 100644 --- a/.gitignore +++ b/.gitignore @@ -126,7 +126,6 @@ celerybeat.pid # Environments .env -.env.local .venv env/ venv/ diff --git a/Dockerfile b/Dockerfile index 24efb0f..c72ed1e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,10 @@ WORKDIR /app # Install dependencies COPY pyproject.toml poetry.lock ./ -RUN pip install --upgrade pip \ +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 \ && poetry config virtualenvs.create false \ && poetry install --no-dev @@ -14,9 +17,5 @@ RUN pip install --upgrade pip \ # Copy the rest of the application code COPY . . -# Environment variables -ENV GUILD_ID=GUILD_ID -ENV BOT_TOKEN=BOT_TOKEN - # Run the bot CMD ["poetry", "run", "python", "src/main.py"] diff --git a/docker-compose.yml b/docker-compose.yml index a0f08ef..3066626 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ services: image: duckbot:latest container_name: duckbot env_file: - - .env.local + - .env environment: - PUID=1000 - PGID=1000