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
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"]
ENTRYPOINT ["/opt/adguardhome/AdGuardHome"]
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
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"
}