Skip to content

Commit

Permalink
refactor docker
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhiTheModder committed Nov 29, 2024
1 parent 6a22817 commit add5482
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 3 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/cloud-image.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ jobs:
uses: docker/build-push-action@v4
with:
context: ./
file: ./Dockerfile
push: true
tags: qbtaumai/moonuserbot:latest
8 changes: 8 additions & 0 deletions Cloudfile
Original file line number Diff line number Diff line change
@@ -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"]
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
services:
moonuserbot:
image: qbtaumai/moonuserbot:latest
build:
context: .
dockerfile: Dockerfile
container_name: moonuserbot
restart: unless-stopped
env_file:
Expand Down
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
version: "3"
services:
moonuserbot:
image: qbtaumai/moonuserbot:latest
build:
context: .
dockerfile: Dockerfile
container_name: moonuserbot
restart: unless-stopped
env_file:
Expand Down

0 comments on commit add5482

Please sign in to comment.