Skip to content

Commit

Permalink
update build script
Browse files Browse the repository at this point in the history
  • Loading branch information
cnk3x committed Aug 30, 2024
1 parent d9b8f57 commit 8db03ec
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ GO_BUILD := CGO_ENABLED=0 GOOS=linux go build -v -ldflags '-s -w -X main.version

DOCKER_BUILD := docker buildx build --push --platform linux/amd64,linux/arm64

VERSION := $(GITTAG)

showTag:
@echo $(GITTAG)

Expand All @@ -26,6 +28,9 @@ latest:: build
versioned:: build
$(DOCKER_BUILD) -t $(HUB)/xunlei:$(VERSION) -t $(GHR)/xunlei:$(VERSION) -t $(ALIR)/xunlei:$(VERSION) -f docker/Dockerfile .

push:: build
$(DOCKER_BUILD) -t $(HUB)/xunlei:$(VERSION) -t $(HUB)/xunlei:latest -t $(GHR)/xunlei:$(VERSION) -t $(GHR)/xunlei:latest -t $(ALIR)/xunlei:$(VERSION) -t $(ALIR)/xunlei:latest -f docker/Dockerfile .

binary:: build
rm -f bin/xlp bin/xlp-amd64.tar.gz
cp bin/xlp-amd64 bin/xlp
Expand Down
8 changes: 4 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM ubuntu:focal as buildTemp
FROM --platform=$BUILDPLATFORM ubuntu:focal AS temp
ARG TARGETARCH

RUN [ "${TARGETARCH}" = "arm64" -o "${TARGETARCH}" = "amd64" ] && echo ok || exit 1
Expand Down Expand Up @@ -33,10 +33,10 @@ COPY bin/xlp-${TARGETARCH} /rootfs/usr/bin/xlp

FROM ubuntu:focal

LABEL org.opencontainers.image.authors "cnk3x"
LABEL org.opencontainers.image.source https://github.com/cnk3x/xunlei
LABEL org.opencontainers.image.authors=cnk3x
LABEL org.opencontainers.image.source=https://github.com/cnk3x/xunlei

COPY --from=buildTemp /rootfs/ /
COPY --from=temp /rootfs/ /

ENV LANG=C.UTF-8 LANG=zh_CN.UTF-8 LANGUAGE=zh_CN.UTF-8 LC_ALL=C \
XL_DEBUG=false \
Expand Down
13 changes: 10 additions & 3 deletions docker/busybox/build.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@


$VERSION = git describe --tags --always

echo $VERSION

docker --debug buildx build `
-t cnk3x/xunlei:busybox `
-t cnk3x/xunlei:3.20.1-busybox `
-t cnk3x/xunlei:$VERSION-busybox `
-t ghcr.io/cnk3x/xunlei:busybox `
-t ghcr.io/cnk3x/xunlei:3.20.1-busybox `
-t ghcr.io/cnk3x/xunlei:$VERSION-busybox `
-t registry.cn-shenzhen.aliyuncs.com/cnk3x/xunlei:busybox `
-t registry.cn-shenzhen.aliyuncs.com/cnk3x/xunlei:3.20.1-busybox `
-t registry.cn-shenzhen.aliyuncs.com/cnk3x/xunlei:$VERSION-busybox `
-f .\docker\busybox\Dockerfile `
--platform "linux/amd64,linux/arm64" `
--push .

8 changes: 5 additions & 3 deletions docker/busybox/build.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
VERSION=$(git describe --tags --always)

docker buildx build \
-t cnk3x/xunlei:busybox \
-t cnk3x/xunlei:3.20.1-busybox \
-t cnk3x/xunlei:${VERSION}-busybox \
-t ghcr.io/cnk3x/xunlei:busybox \
-t ghcr.io/cnk3x/xunlei:3.20.1-busybox \
-t ghcr.io/cnk3x/xunlei:${VERSION}-busybox \
-t registry.cn-shenzhen.aliyuncs.com/cnk3x/xunlei:busybox \
-t registry.cn-shenzhen.aliyuncs.com/cnk3x/xunlei:3.20.1-busybox \
-t registry.cn-shenzhen.aliyuncs.com/cnk3x/xunlei:${VERSION}-busybox \
-f ./docker/busybox/Dockerfile \
--platform "linux/amd64,linux/arm64" \
--push .

0 comments on commit 8db03ec

Please sign in to comment.