[dockerfile] Use ENV GO111MODULE=off when building from openshift/origin-release:golang-1.10

This commit is contained in:
dougbtv 2019-08-31 08:33:02 -04:00
parent 707017a5cd
commit 10692b4538
2 changed files with 41 additions and 16 deletions

View File

@ -13,6 +13,9 @@ env:
- REGISTRY_USER=${REGISTRY_USER} - REGISTRY_USER=${REGISTRY_USER}
- REGISTRY_PASS=${REGISTRY_PASS} - REGISTRY_PASS=${REGISTRY_PASS}
- secure: "${REGISTRY_SECURE}" - secure: "${REGISTRY_SECURE}"
matrix:
- TARGET=amd64
- TARGET=ppc64le
before_install: before_install:
- sudo apt-get update -qq - sudo apt-get update -qq
@ -24,23 +27,28 @@ install:
before_script: before_script:
# Make gopath... to run golint/go fmt/go vet # Make gopath... to run golint/go fmt/go vet
# Suppress golint for fixing lint later. # Suppress golint for fixing lint later.
#- golint ... | grep -v ALL_CAPS | xargs -r false - golint ./... | grep -v vendor | grep -v ALL_CAPS | xargs -r false
- go fmt ./... - go fmt ./...
- go vet ./... - go vet ./...
# - gocyclo -over 15 ./multus # - gocyclo -over 15 ./multus
script: script:
- ./build - GOARCH="${TARGET}" ./build
- sudo env PATH=${PATH} ./test.sh - |
- goveralls -coverprofile=coverage.out -service=travis-ci if [ "${TARGET}" == "amd64" ]; then
- mkdir -p ${TRAVIS_BUILD_DIR}/dist sudo env PATH=${PATH} ./test.sh
- tar cvfz ${TRAVIS_BUILD_DIR}/dist/multus-cni_amd64.tar.gz --warning=no-file-changed --exclude="dist" . goveralls -coverprofile=coverage.out -service=travis-ci
- docker build -t nfvpe/multus . mkdir -p ${TRAVIS_BUILD_DIR}/dist
tar cvfz ${TRAVIS_BUILD_DIR}/dist/multus-cni_amd64.tar.gz --warning=no-file-changed --exclude="dist" .
docker build -t nfvpe/multus:latest-amd64 .
docker build -t nfvpe/multus:latest-ppc64le -f Dockerfile.ppc64le .
docker build -t nfvpe/multus-origin:latest -f Dockerfile.openshift .
fi
deploy: deploy:
# Release on versioned tag (e.g. v1.0) # Release on versioned tag (e.g. v1.0)
- provider: script - provider: script
skip_cleanup: true #skip_cleanup: true
script: curl -sL https://git.io/goreleaser | bash script: curl -sL https://git.io/goreleaser | bash
on: on:
tags: true tags: true
@ -48,13 +56,23 @@ deploy:
condition: "$TRAVIS_TAG =~ ^v[0-9].*$" condition: "$TRAVIS_TAG =~ ^v[0-9].*$"
# Push images to Dockerhub on tag # Push images to Dockerhub on tag
- provider: script - provider: script
skip_cleanup: true
script: > script: >
bash -c ' bash -c '
docker tag nfvpe/multus nfvpe/multus:$TRAVIS_TAG; docker tag nfvpe/multus:latest-amd64 nfvpe/multus:latest;
docker tag nfvpe/multus:latest-amd64 nfvpe/multus:stable;
docker tag nfvpe/multus:latest-amd64 nfvpe/multus:stable-amd64;
docker tag nfvpe/multus:latest-amd64 nfvpe/multus:$TRAVIS_TAG;
docker tag nfvpe/multus:latest-ppc64le nfvpe/multus:stable-ppc64le;
docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASS"; docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASS";
docker push nfvpe/multus; docker push nfvpe/multus:latest;
docker push nfvpe/multus:latest-amd64;
docker push nfvpe/multus:latest-ppc64le;
docker push nfvpe/multus:stable;
docker push nfvpe/multus:stable-amd64;
docker push nfvpe/multus:stable-ppc64le;
docker push nfvpe/multus:$TRAVIS_TAG; docker push nfvpe/multus:$TRAVIS_TAG;
echo foo' echo done'
on: on:
tags: true tags: true
all_branches: true all_branches: true
@ -65,10 +83,17 @@ deploy:
branch: master branch: master
script: > script: >
bash -c ' bash -c '
docker tag nfvpe/multus nfvpe/multus:snapshot; docker tag nfvpe/multus:latest-amd64 nfvpe/multus:snapshot;
docker tag nfvpe/multus:latest-amd64 nfvpe/multus:snapshot-amd64;
docker tag nfvpe/multus:latest-ppc64le nfvpe/multus:snapshot-ppc64le;
docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASS"; docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASS";
docker push nfvpe/multus:snapshot; docker push nfvpe/multus:snapshot;
echo foo' docker push nfvpe/multus:snapshot-amd64;
docker push nfvpe/multus:snapshot-ppc64le;
docker push nfvpe/multus:latest;
docker push nfvpe/multus:latest-amd64;
docker push nfvpe/multus:latest-ppc64le;
echo done'
after_success: after_success:
# put build tgz to bintray # put build tgz to bintray

View File

@ -4,11 +4,11 @@ FROM openshift/origin-release:golang-1.10 as builder
ADD . /usr/src/multus-cni ADD . /usr/src/multus-cni
WORKDIR /usr/src/multus-cni WORKDIR /usr/src/multus-cni
ENV GO111MODULE=off
RUN ./build RUN ./build
FROM openshift/origin-base FROM openshift/origin-base
RUN mkdir -p /usr/src/multus-cni/images && mkdir -p /usr/src/multus-cni/bin RUN mkdir -p /usr/src/multus-cni/images && mkdir -p /usr/src/multus-cni/bin
COPY --from=builder /usr/src/multus-cni/images/70-multus.conf /usr/src/multus-cni/images
COPY --from=builder /usr/src/multus-cni/bin/multus /usr/src/multus-cni/bin COPY --from=builder /usr/src/multus-cni/bin/multus /usr/src/multus-cni/bin
ADD ./images/entrypoint.sh / ADD ./images/entrypoint.sh /
@ -17,4 +17,4 @@ LABEL io.k8s.display-name="Multus CNI" \
io.openshift.tags="openshift" \ io.openshift.tags="openshift" \
maintainer="Doug Smith <dosmith@redhat.com>" maintainer="Doug Smith <dosmith@redhat.com>"
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]