From c1f6da2b520c9aae2aa972cefb12d26bbbd1d3e2 Mon Sep 17 00:00:00 2001 From: Eugene Zbiranik Date: Mon, 11 Feb 2019 15:10:36 +0300 Subject: [PATCH] Build latest from tag branch, edge from master --- Dockerfile.travis | 11 ++++++----- build_docker.sh | 19 ++++++++++++++----- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Dockerfile.travis b/Dockerfile.travis index 31bb339c..4aa05e6c 100644 --- a/Dockerfile.travis +++ b/Dockerfile.travis @@ -3,13 +3,14 @@ LABEL maintainer="AdGuard Team " # Update CA certs 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 -VOLUME /data +VOLUME ["/opt/adguardhome/conf", "/opt/adguardhome/work"] -ENTRYPOINT ["/AdGuardHome"] -CMD ["-h", "0.0.0.0"] \ No newline at end of file +ENTRYPOINT ["/opt/adguardhome/AdGuardHome"] +CMD ["-h", "0.0.0.0", "-c", "/opt/adguardhome/conf/AdGuardHome.yaml", "-w", "/opt/adguardhome/work"] diff --git a/build_docker.sh b/build_docker.sh index 684e1ea9..1123d269 100755 --- a/build_docker.sh +++ b/build_docker.sh @@ -5,9 +5,11 @@ set -o pipefail set -x DOCKERFILE="Dockerfile.travis" -if [ "${TRAVIS_BRANCH}" == "master" ] +IMAGE_NAME="adguard/adguardhome" + +if [[ "${TRAVIS_BRANCH}" == "master" ]] then - VERSION="latest" + VERSION="edge" else VERSION=`git describe --abbrev=4 --dirty --always --tags` fi @@ -37,11 +39,11 @@ build_image() { ;; esac - if [ "${GOOS}" == "linux" ] && [ "${GOARCH}" == "amd64" ] + if [[ "${GOOS}" == "linux" ]] && [[ "${GOARCH}" == "amd64" ]] then - image="adguard/adguardhome:${VERSION}" + image="${IMAGE_NAME}:${VERSION}" else - image="adguard/adguardhome:${imageArch}-${VERSION}" + image="${IMAGE_NAME}:${imageArch}-${VERSION}" fi make cleanfast; CGO_DISABLED=1 make @@ -50,6 +52,13 @@ build_image() { docker tag "multiarch/alpine:${alpineArch}" "$from" docker build -t "${image}" -f ${DOCKERFILE} . 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" }