Try to fix travis again...

This commit is contained in:
Lan Tian 2019-01-08 15:49:54 +08:00
parent d033b9ba3d
commit cad41e6c11
No known key found for this signature in database
GPG Key ID: 27F31700E751EC22
3 changed files with 17 additions and 12 deletions

View File

@ -1,9 +1,6 @@
sudo: required
services:
- docker
language: go
go:
- "1.10"
env:
- PROGRAM=frontend IMAGE_NAME=bird-lg-go IMAGE_ARCH=i386
- PROGRAM=frontend IMAGE_NAME=bird-lg-go IMAGE_ARCH=amd64
@ -17,7 +14,6 @@ env:
install:
- docker run --rm --privileged multiarch/qemu-user-static:register --reset
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- sudo apt-get install -y upx
script:
- |
@ -33,11 +29,6 @@ script:
if [ "$IMAGE_ARCH" == "arm32v7" ]; then IMAGE_ARCH_GO=arm ; fi
if [ "$IMAGE_ARCH" == "arm64v8" ]; then IMAGE_ARCH_GO=arm64; fi
# Build Go binary
mkdir build
GOOS=linux GOARCH=$IMAGE_ARCH_GO go build -ldflags="-s -w -linkmode external -extldflags \"-static\"" -o build/$PROGRAM $PROGRAM/*.go
upx --best build/$PROGRAM
# Build image
docker build \
-t $DOCKER_USERNAME/$IMAGE_NAME:$IMAGE_ARCH \
@ -45,7 +36,7 @@ script:
--build-arg IMAGE_ARCH=$IMAGE_ARCH \
--build-arg IMAGE_ARCH_ALT=$IMAGE_ARCH_ALT \
--build-arg IMAGE_ARCH_GO=$IMAGE_ARCH_GO \
.
$PROGRAM
# 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

View File

@ -2,5 +2,12 @@ ARG THIS_ARCH_ALT=amd64
FROM multiarch/alpine:${THIS_ARCH_ALT}-edge
LABEL Lan Tian "lantian@lantian.pub"
COPY build/frontend /
ENV GOOS=linux GOARCH=${THIS_ARCH_GO}
WORKDIR /root
COPY . .
RUN apk -q --no-cache add git go build-base upx \
&& cd /root && go build -o /frontend && upx /frontend \
&& cd / && rm -rf /root/* \
&& apk del go build-base upx
ENTRYPOINT ["/frontend"]

View File

@ -2,5 +2,12 @@ ARG THIS_ARCH_ALT=amd64
FROM multiarch/alpine:${THIS_ARCH_ALT}-edge
LABEL Lan Tian "lantian@lantian.pub"
COPY build/proxy /
ENV GOOS=linux GOARCH=${THIS_ARCH_GO}
WORKDIR /root
COPY . .
RUN apk -q --no-cache add git go build-base upx \
&& cd /root && go build -o /proxy && upx /proxy \
&& cd / && rm -rf /root/* \
&& apk del go build-base upx
ENTRYPOINT ["/proxy"]