Compare commits

..
2 Commits
Author SHA1 Message Date
loveuer f1411aaeae ci: build CLI artifacts with Docker
Build and Deploy / deploy (push) Successful in 10m13s
2026-09-21 03:02:08 -07:00
loveuer 557ace6150 ci: merge CLI build into deploy workflow
Build and Deploy / deploy (push) Failing after 2s
2026-09-21 01:45:51 -07:00
4 changed files with 40 additions and 20 deletions
+1
View File
@@ -1,5 +1,6 @@
.git/ .git/
data/ data/
dist/
ufile ufile
frontend/node_modules/ frontend/node_modules/
frontend/dist/ frontend/dist/
-19
View File
@@ -1,19 +0,0 @@
name: CLI Build
on:
push:
branches:
- master
jobs:
build:
runs-on: tencent-local
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build CLI binaries
run: ./scripts/build-cli.sh
- name: Verify checksums
run: cd dist && sha256sum -c checksums.txt
+20 -1
View File
@@ -1,4 +1,4 @@
name: Release name: Build and Deploy
on: on:
push: push:
@@ -12,6 +12,25 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Build CLI artifact image
run: |
docker build \
--target cli-artifacts \
--build-arg GOPROXY=https://goproxy.cn,direct \
--build-arg VERSION=${{ github.sha }} \
--build-arg COMMIT=${{ github.sha }} \
-t ufile-cli-artifacts:latest .
- name: Extract CLI binaries
run: |
container="ufile-cli-artifacts-$$"
docker run -d --name "$container" ufile-cli-artifacts:latest
trap 'docker rm -f "$container" >/dev/null 2>&1 || true' EXIT
mkdir -p dist
docker cp "$container:/dist/." dist/
cd dist
sha256sum -c checksums.txt
- name: Build image - name: Build image
run: docker build --build-arg GOPROXY=https://goproxy.cn,direct -t ufile:latest . run: docker build --build-arg GOPROXY=https://goproxy.cn,direct -t ufile:latest .
+19
View File
@@ -18,6 +18,25 @@ COPY *.go ./
COPY --from=frontend /src/frontend/dist ./frontend/dist COPY --from=frontend /src/frontend/dist ./frontend/dist
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /ufile . RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /ufile .
FROM golang:1.24-alpine AS cli-builder
ARG GOPROXY=https://proxy.golang.org,direct
ARG VERSION=dev
ARG COMMIT=unknown
ENV GOPROXY=${GOPROXY}
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY cmd/ufile-cli/ ./cmd/ufile-cli/
COPY scripts/build-cli.sh ./scripts/build-cli.sh
RUN VERSION="${VERSION}" COMMIT="${COMMIT}" ./scripts/build-cli.sh
FROM alpine:3.22 AS cli-artifacts
COPY --from=cli-builder /src/dist /dist
CMD ["sh", "-c", "while :; do sleep 3600; done"]
FROM alpine:3.22 FROM alpine:3.22
RUN addgroup -S -g 10001 ufile \ RUN addgroup -S -g 10001 ufile \