-
Notifications
You must be signed in to change notification settings - Fork 2
68 lines (58 loc) · 1.92 KB
/
Copy pathbuild-and-publish-docker.yml
File metadata and controls
68 lines (58 loc) · 1.92 KB
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
name: Build and Publish Docker
permissions:
contents: read
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: 'Version tag for Docker image'
required: false
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to DockerHub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Determine Docker tag
id: docker_tag
run: |
if [ "${{ github.event_name }}" == "release" ]; then
echo "TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
elif [ -n "${{ github.event.inputs.version }}" ]; then
echo "TAG=${{ github.event.inputs.version }}" >> $GITHUB_ENV
else
echo "TAG=latest" >> $GITHUB_ENV
fi
echo "Docker tag set to $TAG"
- name: Update config.json host before build
run: |
jq '.server.host = "0.0.0.0"' config.json > config.tmp.json
mv config.tmp.json config.json
- name: Build and push Docker image
env:
IMAGE_NAME: dorowolf/akari-bot-webrender
run: |
docker buildx create --use
if [ "${{ github.event_name }}" == "release" ] && [ "${{ github.event.release.prerelease }}" == "false" ]; then
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t $IMAGE_NAME:$TAG \
-t $IMAGE_NAME:latest \
--push .
else
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t $IMAGE_NAME:$TAG \
--push .
fi