diff --git a/Dockerfile b/Dockerfile index 69cf9c8..2ed49cf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,4 @@ -FROM python:3.9-slim - -# Install Redis -RUN apt-get update && apt-get install -y redis-server && apt-get clean && rm -rf /var/lib/apt/lists/* +FROM python:3.10-alpine # Set the working directory WORKDIR /app @@ -9,14 +6,11 @@ WORKDIR /app # Copy requirements.txt if you have one COPY requirements.txt . -# Install dependencies -RUN pip install --no-cache-dir -r requirements.txt - -# If you don't have a requirements.txt, you can install directly -# RUN pip install --no-cache-dir python-telegram-bot>=20.0 +# Upgrade pip and setuptools, then install dependencies +RUN pip install --upgrade pip setuptools && pip install --no-cache-dir -r requirements.txt # Copy the rest of your application code -COPY . . +COPY bot.py . -# Start Redis and run the bot -CMD ["sh", "-c", "redis-server --daemonize yes && python bot.py"] +# Start the bot +CMD ["python", "bot.py"] diff --git a/docker-compose-build.yml b/docker-compose-build.yml deleted file mode 100644 index b4976c9..0000000 --- a/docker-compose-build.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: linkwarden-telegram-bot -services: - bot: - build: - context: . - dockerfile: Dockerfile - container_name: telegram-linkwarden-bot - networks: - - linkwarden-internal - environment: - - TELEGRAM_TOKEN=${TELEGRAM_TOKEN} - - LINKWARDEN_API_URL=${LINKWARDEN_API_URL} - - LINKWARDEN_API_KEY=${LINKWARDEN_API_KEY} - - LINKWARDEN_COLLECTION_ID=${LINKWARDEN_COLLECTION_ID} - restart: unless-stopped - -networks: - linkwarden-internal: diff --git a/docker-compose.yml b/docker-compose.yml index b25461b..d04b652 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,14 @@ -name: linkwarden-telegram-bot +name: linkwarden services: linkwarden-telegram-bot: container_name: telegram-linkwarden-bot + build: + context: . + dockerfile: Dockerfile image: ghcr.io/orguetta/linkwarden-telegram-bot:latest networks: - - linkwarden-internal + - internal environment: - TELEGRAM_TOKEN=${TELEGRAM_TOKEN} - LINKWARDEN_API_URL=${LINKWARDEN_API_URL} @@ -14,4 +17,4 @@ services: restart: unless-stopped networks: - linkwarden-internal: + internal: