Build latest from tag branch, edge from master

This commit is contained in:
Eugene Zbiranik 2019-02-11 15:10:36 +03:00
parent a40ddb094b
commit c1f6da2b52
2 changed files with 20 additions and 10 deletions

View file

@ -3,13 +3,14 @@ LABEL maintainer="AdGuard Team <devteam@adguard.com>"
# Update CA certs # Update CA certs
RUN apk --no-cache --update add ca-certificates && \ RUN apk --no-cache --update add ca-certificates && \
rm -rf /var/cache/apk/* rm -rf /var/cache/apk/* && mkdir -p /opt/adguardhome
COPY ./AdGuardHome /AdGuardHome
COPY ./AdGuardHome /opt/adguardhome/AdGuardHome
EXPOSE 53 3000 EXPOSE 53 3000
VOLUME /data VOLUME ["/opt/adguardhome/conf", "/opt/adguardhome/work"]
ENTRYPOINT ["/AdGuardHome"] ENTRYPOINT ["/opt/adguardhome/AdGuardHome"]
CMD ["-h", "0.0.0.0"] CMD ["-h", "0.0.0.0", "-c", "/opt/adguardhome/conf/AdGuardHome.yaml", "-w", "/opt/adguardhome/work"]

View file

@ -5,9 +5,11 @@ set -o pipefail
set -x set -x
DOCKERFILE="Dockerfile.travis" DOCKERFILE="Dockerfile.travis"
if [ "${TRAVIS_BRANCH}" == "master" ] IMAGE_NAME="adguard/adguardhome"
if [[ "${TRAVIS_BRANCH}" == "master" ]]
then then
VERSION="latest" VERSION="edge"
else else
VERSION=`git describe --abbrev=4 --dirty --always --tags` VERSION=`git describe --abbrev=4 --dirty --always --tags`
fi fi
@ -37,11 +39,11 @@ build_image() {
;; ;;
esac esac
if [ "${GOOS}" == "linux" ] && [ "${GOARCH}" == "amd64" ] if [[ "${GOOS}" == "linux" ]] && [[ "${GOARCH}" == "amd64" ]]
then then
image="adguard/adguardhome:${VERSION}" image="${IMAGE_NAME}:${VERSION}"
else else
image="adguard/adguardhome:${imageArch}-${VERSION}" image="${IMAGE_NAME}:${imageArch}-${VERSION}"
fi fi
make cleanfast; CGO_DISABLED=1 make make cleanfast; CGO_DISABLED=1 make
@ -50,6 +52,13 @@ build_image() {
docker tag "multiarch/alpine:${alpineArch}" "$from" docker tag "multiarch/alpine:${alpineArch}" "$from"
docker build -t "${image}" -f ${DOCKERFILE} . docker build -t "${image}" -f ${DOCKERFILE} .
docker push ${image} docker push ${image}
if [[ "${VERSION}" != "edge" ]]
then
latest=${image/$VERSION/latest}
docker tag "${image}" "${latest}"
docker push ${latest}
docker rmi ${latest}
fi
docker rmi "$from" docker rmi "$from"
} }