Try to fix travis again, add UPX compression

This commit is contained in:
Lan Tian 2019-01-08 14:54:42 +08:00
parent 8376d0d182
commit 2844310678
No known key found for this signature in database
GPG Key ID: 27F31700E751EC22
3 changed files with 12 additions and 10 deletions

View File

@ -5,18 +5,19 @@ language: go
go: go:
- "1.10" - "1.10"
env: env:
- PROGRAM=frontend IMAGE_NAME=bird-lg-go IMAGE_ARCH=i386 # - PROGRAM=frontend IMAGE_NAME=bird-lg-go IMAGE_ARCH=i386
- PROGRAM=frontend IMAGE_NAME=bird-lg-go IMAGE_ARCH=amd64 - PROGRAM=frontend IMAGE_NAME=bird-lg-go IMAGE_ARCH=amd64
- PROGRAM=frontend IMAGE_NAME=bird-lg-go IMAGE_ARCH=arm32v7 # - PROGRAM=frontend IMAGE_NAME=bird-lg-go IMAGE_ARCH=arm32v7
- PROGRAM=frontend IMAGE_NAME=bird-lg-go IMAGE_ARCH=arm64v8 # - PROGRAM=frontend IMAGE_NAME=bird-lg-go IMAGE_ARCH=arm64v8
- PROGRAM=proxy IMAGE_NAME=bird-lgproxy-go IMAGE_ARCH=i386 # - PROGRAM=proxy IMAGE_NAME=bird-lgproxy-go IMAGE_ARCH=i386
- PROGRAM=proxy IMAGE_NAME=bird-lgproxy-go IMAGE_ARCH=amd64 # - PROGRAM=proxy IMAGE_NAME=bird-lgproxy-go IMAGE_ARCH=amd64
- PROGRAM=proxy IMAGE_NAME=bird-lgproxy-go IMAGE_ARCH=arm32v7 # - PROGRAM=proxy IMAGE_NAME=bird-lgproxy-go IMAGE_ARCH=arm32v7
- PROGRAM=proxy IMAGE_NAME=bird-lgproxy-go IMAGE_ARCH=arm64v8 # - PROGRAM=proxy IMAGE_NAME=bird-lgproxy-go IMAGE_ARCH=arm64v8
install: install:
- docker run --rm --privileged multiarch/qemu-user-static:register --reset - docker run --rm --privileged multiarch/qemu-user-static:register --reset
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- apt-get install -y upx
script: script:
- | - |
@ -35,6 +36,7 @@ script:
# Build Go binary # Build Go binary
mkdir build mkdir build
GOOS=linux GOARCH=$IMAGE_ARCH_GO go build -ldflags="-s -w" -o build/$PROGRAM $PROGRAM/*.go GOOS=linux GOARCH=$IMAGE_ARCH_GO go build -ldflags="-s -w" -o build/$PROGRAM $PROGRAM/*.go
upx --best build/$PROGRAM
# Build image # Build image
docker build \ docker build \
@ -43,7 +45,7 @@ script:
--build-arg IMAGE_ARCH=$IMAGE_ARCH \ --build-arg IMAGE_ARCH=$IMAGE_ARCH \
--build-arg IMAGE_ARCH_ALT=$IMAGE_ARCH_ALT \ --build-arg IMAGE_ARCH_ALT=$IMAGE_ARCH_ALT \
--build-arg IMAGE_ARCH_GO=$IMAGE_ARCH_GO \ --build-arg IMAGE_ARCH_GO=$IMAGE_ARCH_GO \
$IMAGE_NAME .
# Tag image :{arch} and :{arch}-build{build number} # Tag image :{arch} and :{arch}-build{build number}
docker tag $DOCKER_USERNAME/$IMAGE_NAME:$IMAGE_ARCH $DOCKER_USERNAME/$IMAGE_NAME:$IMAGE_ARCH-build$TRAVIS_BUILD_NUMBER docker tag $DOCKER_USERNAME/$IMAGE_NAME:$IMAGE_ARCH $DOCKER_USERNAME/$IMAGE_NAME:$IMAGE_ARCH-build$TRAVIS_BUILD_NUMBER

View File

@ -3,4 +3,4 @@ FROM multiarch/alpine:${THIS_ARCH_ALT}-edge
LABEL Lan Tian "lantian@lantian.pub" LABEL Lan Tian "lantian@lantian.pub"
COPY build/frontend / COPY build/frontend /
ENTRYPOINT ["/frontend"] ENTRYPOINT ["/lib/ld-musl-x86_64.so.1 /frontend"]

View File

@ -3,4 +3,4 @@ FROM multiarch/alpine:${THIS_ARCH_ALT}-edge
LABEL Lan Tian "lantian@lantian.pub" LABEL Lan Tian "lantian@lantian.pub"
COPY build/proxy / COPY build/proxy /
ENTRYPOINT ["/proxy"] ENTRYPOINT ["/lib/ld-musl-x86_64.so.1 /proxy"]