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
|
||||
with:
|
||||
context: ./
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
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
|
||||
|
||||
### 👷♂️`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
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
services:
|
||||
moonuserbot:
|
||||
image: qbtaumai/moonuserbot:latest
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: moonuserbot
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
version: "3"
|
||||
services:
|
||||
moonuserbot:
|
||||
image: qbtaumai/moonuserbot:latest
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: moonuserbot
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
|
||||
Reference in New Issue
Block a user