feat: docker ci/cd workflows

This commit is contained in:
Zhang Minghan 2023-12-25 14:40:45 +08:00
parent 3c68278ed7
commit 56f0994451
3 changed files with 55 additions and 1 deletions

26
.github/workflows/docker-cd.yaml vendored Normal file
View File

@ -0,0 +1,26 @@
name: Docker CD
on:
release:
types: [created]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build the Docker image
run: docker build . --file Dockerfile --tag programzmh/chatnio:stable
- name: Push to DockerHub
run: docker push programzmh/chatnio:stable

26
.github/workflows/docker-ci.yaml vendored Normal file
View File

@ -0,0 +1,26 @@
name: Docker Image CI
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build the Docker image
run: docker build . --file Dockerfile --tag programzmh/chatnio:latest
- name: Push to DockerHub
run: docker push programzmh/chatnio:latest

View File

@ -28,7 +28,7 @@ services:
- chatnio-network
chatnio:
build: .
image: programzmh/chatnio
container_name: chatnio
restart: always
ports:
@ -49,6 +49,8 @@ services:
REDIS_PASSWORD: ""
REDIS_DB: 0
SERVE_STATIC: "true"
volumes:
- ./config.yaml:/config.yaml
networks:
- chatnio-network