refactor docker
This commit is contained in:
27
.github/workflows/cloud-image.yml
vendored
Normal file
27
.github/workflows/cloud-image.yml
vendored
Normal file
@@ -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
.github/workflows/docker-image.yml
vendored
1
.github/workflows/docker-image.yml
vendored
@@ -22,5 +22,6 @@ jobs:
|
|||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: ./
|
context: ./
|
||||||
|
file: ./Dockerfile
|
||||||
push: true
|
push: true
|
||||||
tags: qbtaumai/moonuserbot:latest
|
tags: qbtaumai/moonuserbot:latest
|
||||||
|
|||||||
8
Cloudfile
Normal file
8
Cloudfile
Normal file
@@ -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"]
|
||||||
@@ -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
|
- Put your environment vars in `.env` file check [.env.dist](/.env.dist) for example format
|
||||||
|
|
||||||
### 👷♂️`docker run`:
|
### 👷♂️`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:
|
- Start:
|
||||||
|
1. If you want to use normal image:
|
||||||
```shell
|
```shell
|
||||||
docker run --env-file ./.env -d qbtaumai/moonuserbot:latest
|
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:
|
- Updating:
|
||||||
```shell
|
```shell
|
||||||
docker stop $(docker ps -q) && docker rm $(docker ps -a -q)
|
docker stop $(docker ps -q)
|
||||||
```
|
```
|
||||||
then re-run the start command
|
then re-run the start command
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
services:
|
services:
|
||||||
moonuserbot:
|
moonuserbot:
|
||||||
image: qbtaumai/moonuserbot:latest
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
container_name: moonuserbot
|
container_name: moonuserbot
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file:
|
env_file:
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
version: "3"
|
version: "3"
|
||||||
services:
|
services:
|
||||||
moonuserbot:
|
moonuserbot:
|
||||||
image: qbtaumai/moonuserbot:latest
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
container_name: moonuserbot
|
container_name: moonuserbot
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file:
|
env_file:
|
||||||
|
|||||||
Reference in New Issue
Block a user