-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (89 loc) · 2.84 KB
/
docker-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Build and Push Docker Images
on:
push:
branches:
- main
paths-ignore:
- 'LICENSE'
- 'README.md'
- 'README_FR.md'
pull_request:
branches:
- main
paths-ignore:
- 'LICENSE'
- 'README.md'
- 'README_FR.md'
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-24.04
steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4
# Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Cache Docker layers to speed up builds
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
# Log in to Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Build and push Bot Docker image
- name: Build and push Bot Docker image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.bot
push: true
tags: tiritibambix/cleanbot:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-bot
platforms: linux/arm64,linux/amd64
# Build and push Web Docker image
- name: Build and push Web Docker image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.web
push: true
tags: tiritibambix/cleanbot-web:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-web
platforms: linux/arm64,linux/amd64
# Update cache for next run
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-bot /tmp/.buildx-cache
# Logout from Docker Hub
- name: Logout from Docker Hub
run: docker logout
# Update Bot Docker Hub Description
- name: Update Bot Docker Hub Description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: tiritibambix/cleanbot
readme-filepath: ./README.md
short-description: "Discord bot for automated channel purging with scheduling capabilities"
# Update Web Docker Hub Description
- name: Update Web Docker Hub Description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: tiritibambix/cleanbot-web
readme-filepath: ./README.md
short-description: "Web interface for Cleanbot Discord purge scheduler"