Skip to content

Commit d372d42

Browse files
committed
fix: docker file bug
1 parent 61f087c commit d372d42

File tree

4 files changed

+34
-121
lines changed

4 files changed

+34
-121
lines changed

.github/workflows/docker.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,21 @@ jobs:
2525
contents: read
2626
attestations: write
2727
id-token: write
28+
strategy:
29+
matrix:
30+
platform:
31+
- linux/amd64
32+
- linux/arm64
2833
steps:
2934
- name: Check out the repo
3035
uses: actions/checkout@v5
3136

37+
- name: Set up QEMU
38+
uses: docker/setup-qemu-action@v3
39+
40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@v3
42+
3243
- name: Log in to Docker Hub
3344
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
3445
with:
@@ -49,10 +60,11 @@ jobs:
4960
5061
- name: Build and push Docker image
5162
id: push
52-
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
63+
uses: docker/build-push-action@v5
5364
with:
5465
context: .
5566
file: ./Dockerfile
67+
platforms: ${{ matrix.platform }}
5668
push: true
5769
tags: ${{ steps.meta.outputs.tags }}
5870
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
11
FROM alpine:3.18
22

3-
# Minimal runtime image. At container start the entrypoint downloads the
4-
# latest release binary (Aio-linux-amd64 by default) and runs it. The image
5-
# also includes a default `all-in-one-bot.yml` so the container can run
6-
# without host-provided config; users can override by bind-mounting
7-
# ./config -> /usr/local/etc/aio.
8-
93
RUN apk add --no-cache curl ca-certificates bash
104

115
WORKDIR /
126

13-
# Copy entrypoint script that will download the release asset at runtime
14-
COPY entrypoint.sh /entrypoint.sh
15-
RUN chmod +x /entrypoint.sh
16-
17-
# Provide a default config baked into the image. On first startup, entrypoint
18-
# copies this to the host mount if it doesn't exist. Users can then edit
19-
# ./config/all-in-one-bot.yml and restart the container.
20-
RUN mkdir -p /usr/local/etc/aio && chmod 0755 /usr/local/etc/aio
21-
COPY all-in-one-bot.yml /usr/local/etc/aio/all-in-one-bot.yml.default
7+
# 根据架构下载二进制文件、创建配置文件和日志目录
8+
RUN set -e; \
9+
ARCH=$(uname -m); \
10+
if [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "amd64" ]; then \
11+
AIO_BIN="Aio-linux-amd64"; \
12+
elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then \
13+
AIO_BIN="Aio-linux-arm64"; \
14+
else \
15+
echo "Unsupported architecture: $ARCH"; exit 1; \
16+
fi; \
17+
mkdir -p /usr/local/bin /usr/local/etc/aio /var/log/aio; \
18+
chmod 0755 /usr/local/etc/aio /var/log/aio; \
19+
LATEST=$(curl -sL https://api.github.com/repos/uerax/all-in-one-bot/releases/latest | grep "tag_name" | cut -d '"' -f 4); \
20+
curl -L "https://github.com/uerax/all-in-one-bot/releases/download/$LATEST/$AIO_BIN" -o /usr/local/bin/aio; \
21+
chmod +x /usr/local/bin/aio; \
22+
if [ ! -f /usr/local/etc/aio/all-in-one-bot.yml ]; then \
23+
curl -L "https://raw.githubusercontent.com/uerax/all-in-one-bot/master/all-in-one-bot.yml" -o /usr/local/etc/aio/all-in-one-bot.yml; \
24+
echo "Configuration downloaded. Please edit /usr/local/etc/aio/all-in-one-bot.yml and restart the container."; \
25+
exit 0; \
26+
fi
2227

23-
# Keep logs as a volume so logs can be persisted by the host if desired
2428
VOLUME ["/var/log/aio"]
2529

2630
ENV TZ=Asia/Shanghai
2731

28-
ENTRYPOINT ["/entrypoint.sh"]
32+
CMD ["/usr/local/bin/aio", "-c", "/usr/local/etc/aio/all-in-one-bot.yml"]

docker-compose.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Docker Compose configuration for all-in-one-bot
22
# The image is pulled from Docker Hub (uerax/aio:latest by default)
33
# No need to build locally; just run: docker compose up -d
4-
5-
version: "3.8"
6-
74
services:
85
bot:
96
image: uerax/aio:latest

entrypoint.sh

Lines changed: 0 additions & 100 deletions
This file was deleted.

0 commit comments

Comments
 (0)