diff --git a/.github/workflows/cloud-image.yml b/.github/workflows/cloud-image.yml new file mode 100644 index 00000000..7b1299ec --- /dev/null +++ b/.github/workflows/cloud-image.yml @@ -0,0 +1,27 @@ +name: Cloud Docker Image CI + +on: + push: + branches: + - main +jobs: + push_to_registry: + name: Cloud Docker Image CI + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: ./ + file: ./Cloudfile + push: true + tags: qbtaumai/moonubcloud:latest-cloud diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 7d3c5431..18e096f7 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -22,5 +22,6 @@ jobs: uses: docker/build-push-action@v4 with: context: ./ + file: ./Dockerfile push: true tags: qbtaumai/moonuserbot:latest diff --git a/Cloudfile b/Cloudfile new file mode 100644 index 00000000..f5d8283f --- /dev/null +++ b/Cloudfile @@ -0,0 +1,8 @@ +FROM python:3.11 +WORKDIR /app +COPY . /app +RUN apt-get -qq update && apt-get -qq install -y git wget ffmpeg mediainfo \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --no-cache-dir -r requirements.txt +CMD ["bash", "cloud.sh"] \ No newline at end of file diff --git a/README.md b/README.md index af84f038..c4ae8563 100644 --- a/README.md +++ b/README.md @@ -90,14 +90,20 @@ You can either use `docker run` or `docker compose`. - Put your environment vars in `.env` file check [.env.dist](/.env.dist) for example format ### 👷‍♂️`docker run`: +We also push images to [Docker Hub](https://hub.docker.com/), so you can use the following commands to start and update the service: - Start: + 1. If you want to use normal image: ```shell docker run --env-file ./.env -d qbtaumai/moonuserbot:latest ``` + 2. If you want to use image with flask web (only recommended for heroku/koyeb/render etc.): + ```shell + docker run --env-file ./.env -d qbtaumai/moonubcloud:latest-cloud + ``` - Updating: ```shell - docker stop $(docker ps -q) && docker rm $(docker ps -a -q) + docker stop $(docker ps -q) ``` then re-run the start command diff --git a/compose.yml b/compose.yml index 86b92cbc..5c01f341 100644 --- a/compose.yml +++ b/compose.yml @@ -1,6 +1,8 @@ services: moonuserbot: - image: qbtaumai/moonuserbot:latest + build: + context: . + dockerfile: Dockerfile container_name: moonuserbot restart: unless-stopped env_file: diff --git a/docker-compose.yml b/docker-compose.yml index cf04c726..604020bc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,9 @@ version: "3" services: moonuserbot: - image: qbtaumai/moonuserbot:latest + build: + context: . + dockerfile: Dockerfile container_name: moonuserbot restart: unless-stopped env_file: