Try to fix travis again...
This commit is contained in:
parent
d033b9ba3d
commit
cad41e6c11
11
.travis.yml
11
.travis.yml
@ -1,9 +1,6 @@
|
|||||||
sudo: required
|
sudo: required
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
language: go
|
|
||||||
go:
|
|
||||||
- "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
|
||||||
@ -17,7 +14,6 @@ env:
|
|||||||
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
|
||||||
- sudo apt-get install -y upx
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- |
|
- |
|
||||||
@ -33,11 +29,6 @@ script:
|
|||||||
if [ "$IMAGE_ARCH" == "arm32v7" ]; then IMAGE_ARCH_GO=arm ; fi
|
if [ "$IMAGE_ARCH" == "arm32v7" ]; then IMAGE_ARCH_GO=arm ; fi
|
||||||
if [ "$IMAGE_ARCH" == "arm64v8" ]; then IMAGE_ARCH_GO=arm64; 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
|
# Build image
|
||||||
docker build \
|
docker build \
|
||||||
-t $DOCKER_USERNAME/$IMAGE_NAME:$IMAGE_ARCH \
|
-t $DOCKER_USERNAME/$IMAGE_NAME:$IMAGE_ARCH \
|
||||||
@ -45,7 +36,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 \
|
||||||
.
|
$PROGRAM
|
||||||
|
|
||||||
# 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
|
||||||
|
@ -2,5 +2,12 @@ ARG THIS_ARCH_ALT=amd64
|
|||||||
FROM multiarch/alpine:${THIS_ARCH_ALT}-edge
|
FROM multiarch/alpine:${THIS_ARCH_ALT}-edge
|
||||||
|
|
||||||
LABEL Lan Tian "lantian@lantian.pub"
|
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"]
|
ENTRYPOINT ["/frontend"]
|
||||||
|
@ -2,5 +2,12 @@ ARG THIS_ARCH_ALT=amd64
|
|||||||
FROM multiarch/alpine:${THIS_ARCH_ALT}-edge
|
FROM multiarch/alpine:${THIS_ARCH_ALT}-edge
|
||||||
|
|
||||||
LABEL Lan Tian "lantian@lantian.pub"
|
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"]
|
ENTRYPOINT ["/proxy"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user