Skip to content

Commit d303d03

Browse files
authored
Add pixiu-aio supported (pixiu-io#337)
1 parent aa4445e commit d303d03

File tree

6 files changed

+77
-12
lines changed

6 files changed

+77
-12
lines changed

.github/workflows/build-image.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Build images for CI
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
7+
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v3
13+
14+
- name: Build the dashboard image
15+
run: make image
16+
17+
- name: Build the pixiu aio image
18+
run: make image-aio

.github/workflows/ci.yml

-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,3 @@ jobs:
1919
- run: npm ci # 下载包
2020
- run: npm run prettier # 格式化
2121
- run: npm run lint # eslint检查
22-
23-
- name: Build the Docker image
24-
run: make image

.github/workflows/docker-image.yml

+24-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish dashboard image
1+
name: Publish dashboard and pixiu aio images
22

33
on:
44
push:
@@ -9,13 +9,28 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: actions/checkout@v3
12+
- name: Checkout
13+
uses: actions/checkout@v3
1314

14-
- name: Login in dockerhub
15-
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
16-
with:
17-
username: jacky06
18-
password: jacky06jacky06
15+
- name: Get short commit hash
16+
run: |
17+
echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
18+
echo "TIMESTAMP=$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV
1919
20-
- name: Build and push the Docker image
21-
run: make image && make push
20+
- name: Set up QEMU
21+
uses: docker/setup-qemu-action@v3
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
26+
- name: Login in dockerhub
27+
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
28+
with:
29+
username: jacky06
30+
password: jacky06jacky06
31+
32+
- name: Build and push dashboard image
33+
run: make push
34+
35+
- name: Build and push pixiu aio image
36+
run: make push-aio

Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,11 @@ image:
2121
push: image
2222
docker push ${dockerhubUser}/${releaseName}:${tag}
2323

24+
image-aio:
25+
docker build -t ${dockerhubUser}/pixiu-aio:${tag} --platform=linux -f docker/Dockerfile-aio .
26+
27+
push-aio: image-aio
28+
docker push ${dockerhubUser}/pixiu-aio:${tag}
29+
2430
clean:
2531
-rm -rf ./dist ./node_modules

docker/Dockerfile-aio

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM golang:1.17 as pixiu-builder
2+
WORKDIR /app
3+
ARG VERSION
4+
ENV GOPROXY=https://goproxy.cn
5+
RUN git clone https://github.com/caoyingjunz/pixiu.git && cp -r pixiu/* . && rm -rf pixiu
6+
RUN CGO_ENABLED=0 go build -ldflags "-s -w -X 'main.version=${VERSION}'" -o pixiu ./cmd
7+
8+
FROM node:16.18.0-alpine as builder
9+
LABEL MAINTAINER="PIXIU"
10+
WORKDIR /build
11+
COPY . .
12+
RUN npm config set registry https://registry.npmmirror.com/ && npm install && npm run build
13+
14+
FROM nginx:alpine
15+
LABEL MAINTAINER="PIXIU"
16+
COPY --from=builder /build/dist /usr/share/nginx/html/pixiu
17+
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
18+
COPY --from=pixiu-builder /app/pixiu /app
19+
COPY docker/start.sh /usr/local/bin/pixiu_start
20+
21+
CMD ['pixiu_start']

docker/start.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
set -o errexit
2+
set -o xtrace
3+
4+
echo "Starting pixiu dashboard service"
5+
nginx -g 'daemon on;'
6+
7+
echo "Starting pixiu backend service"
8+
/app

0 commit comments

Comments
 (0)