Merge pull request #142 in DNS/adguard-dns from feature/562 to master

* commit '09b49d01450f059ecc4649433a1510f31d2205ac':
  Add Docker Hub image builds
This commit is contained in:
Eugene Bujak 2019-01-30 15:07:23 +03:00
commit b216475c20
7 changed files with 122 additions and 145 deletions

View File

@ -61,4 +61,21 @@ matrix:
tags: true tags: true
draft: true draft: true
file_glob: true file_glob: true
skip_cleanup: true skip_cleanup: true
- name: docker
if: type != pull_request AND (branch = master OR tag = true)
go:
- 1.11.x
os:
- linux
services:
- docker
before_script:
- nvm install node
- npm install -g npm
script:
- docker login -u="$DOCKER_USER" -p="$DOCKER_PASSWORD"
- ./build_docker.sh
after_script:
- docker images

24
Dockerfile Normal file
View File

@ -0,0 +1,24 @@
FROM golang:alpine AS build
RUN apk add --update git make build-base npm && \
rm -rf /var/cache/apk/*
WORKDIR /src/AdGuardHome
COPY . /src/AdGuardHome
RUN make
FROM alpine:latest
LABEL maintainer="AdGuard Team <devteam@adguard.com>"
# Update CA certs
RUN apk --no-cache --update add ca-certificates && \
rm -rf /var/cache/apk/*
COPY --from=build /src/AdGuardHome/AdGuardHome /AdGuardHome
EXPOSE 53 3000
VOLUME /data
ENTRYPOINT ["/AdGuardHome"]
CMD ["-h", "0.0.0.0"]

View File

@ -1,48 +0,0 @@
FROM easypi/alpine-arm:latest
LABEL maintainer="Erik Rogers <erik.rogers@live.com>"
# AdGuard version
ARG ADGUARD_VERSION="0.92-hotfix2"
ENV ADGUARD_VERSION $ADGUARD_VERSION
# AdGuard architecture and package info
ARG ADGUARD_ARCH="linux_arm"
ENV ADGUARD_ARCH ${ADGUARD_ARCH}
ENV ADGUARD_PACKAGE "AdGuardHome_v${ADGUARD_VERSION}_${ADGUARD_ARCH}"
# AdGuard release info
ARG ADGUARD_ARCHIVE="${ADGUARD_PACKAGE}.tar.gz"
ENV ADGUARD_ARCHIVE ${ADGUARD_ARCHIVE}
ARG ADGUARD_RELEASE="https://github.com/AdguardTeam/AdGuardHome/releases/download/v${ADGUARD_VERSION}/${ADGUARD_ARCHIVE}"
ENV ADGUARD_RELEASE ${ADGUARD_RELEASE}
# AdGuard directory
ARG ADGUARD_DIR="/data/adguard"
ENV ADGUARD_DIR ${ADGUARD_DIR}
# Update CA certs and download AdGuard binaries
RUN apk --no-cache --update add ca-certificates \
&& cd /tmp \
&& wget ${ADGUARD_RELEASE} \
&& tar xvf ${ADGUARD_ARCHIVE} \
&& mkdir -p "${ADGUARD_DIR}" \
&& cp "AdGuardHome/AdGuardHome" "${ADGUARD_DIR}" \
&& chmod +x "${ADGUARD_DIR}/AdGuardHome" \
&& rm -rf "AdGuardHome" \
&& rm ${ADGUARD_ARCHIVE}
# Expose DNS port 53
EXPOSE 53
# Expose UI port 3000
ARG ADGUARD_UI_HOST="0.0.0.0"
ENV ADGUARD_UI_HOST ${ADGUARD_UI_HOST}
ARG ADGUARD_UI_PORT="3000"
ENV ADGUARD_UI_PORT ${ADGUARD_UI_PORT}
EXPOSE ${ADGUARD_UI_PORT}
# Run AdGuardHome
WORKDIR ${ADGUARD_DIR}
VOLUME ${ADGUARD_DIR}
ENTRYPOINT ./AdGuardHome --host ${ADGUARD_UI_HOST} --port ${ADGUARD_UI_PORT}

View File

@ -1,48 +0,0 @@
FROM alpine:latest
LABEL maintainer="Erik Rogers <erik.rogers@live.com>"
# AdGuard version
ARG ADGUARD_VERSION="0.92-hotfix2"
ENV ADGUARD_VERSION $ADGUARD_VERSION
# AdGuard architecture and package info
ARG ADGUARD_ARCH="linux_386"
ENV ADGUARD_ARCH ${ADGUARD_ARCH}
ENV ADGUARD_PACKAGE "AdGuardHome_v${ADGUARD_VERSION}_${ADGUARD_ARCH}"
# AdGuard release info
ARG ADGUARD_ARCHIVE="${ADGUARD_PACKAGE}.tar.gz"
ENV ADGUARD_ARCHIVE ${ADGUARD_ARCHIVE}
ARG ADGUARD_RELEASE="https://github.com/AdguardTeam/AdGuardHome/releases/download/v${ADGUARD_VERSION}/${ADGUARD_ARCHIVE}"
ENV ADGUARD_RELEASE ${ADGUARD_RELEASE}
# AdGuard directory
ARG ADGUARD_DIR="/data/adguard"
ENV ADGUARD_DIR ${ADGUARD_DIR}
# Update CA certs and download AdGuard binaries
RUN apk --no-cache --update add ca-certificates \
&& cd /tmp \
&& wget ${ADGUARD_RELEASE} \
&& tar xvf ${ADGUARD_ARCHIVE} \
&& mkdir -p "${ADGUARD_DIR}" \
&& cp "AdGuardHome/AdGuardHome" "${ADGUARD_DIR}" \
&& chmod +x "${ADGUARD_DIR}/AdGuardHome" \
&& rm -rf "AdGuardHome" \
&& rm ${ADGUARD_ARCHIVE}
# Expose DNS port 53
EXPOSE 53
# Expose UI port 3000
ARG ADGUARD_UI_HOST="0.0.0.0"
ENV ADGUARD_UI_HOST ${ADGUARD_UI_HOST}
ARG ADGUARD_UI_PORT="3000"
ENV ADGUARD_UI_PORT ${ADGUARD_UI_PORT}
EXPOSE ${ADGUARD_UI_PORT}
# Run AdGuardHome
WORKDIR ${ADGUARD_DIR}
VOLUME ${ADGUARD_DIR}
ENTRYPOINT ./AdGuardHome --host ${ADGUARD_UI_HOST} --port ${ADGUARD_UI_PORT}

View File

@ -1,48 +0,0 @@
FROM alpine:latest
LABEL maintainer="Erik Rogers <erik.rogers@live.com>"
# AdGuard version
ARG ADGUARD_VERSION="0.92-hotfix2"
ENV ADGUARD_VERSION $ADGUARD_VERSION
# AdGuard architecture and package info
ARG ADGUARD_ARCH="linux_amd64"
ENV ADGUARD_ARCH ${ADGUARD_ARCH}
ENV ADGUARD_PACKAGE "AdGuardHome_v${ADGUARD_VERSION}_${ADGUARD_ARCH}"
# AdGuard release info
ARG ADGUARD_ARCHIVE="${ADGUARD_PACKAGE}.tar.gz"
ENV ADGUARD_ARCHIVE ${ADGUARD_ARCHIVE}
ARG ADGUARD_RELEASE="https://github.com/AdguardTeam/AdGuardHome/releases/download/v${ADGUARD_VERSION}/${ADGUARD_ARCHIVE}"
ENV ADGUARD_RELEASE ${ADGUARD_RELEASE}
# AdGuard directory
ARG ADGUARD_DIR="/data/adguard"
ENV ADGUARD_DIR ${ADGUARD_DIR}
# Update CA certs and download AdGuard binaries
RUN apk --no-cache --update add ca-certificates \
&& cd /tmp \
&& wget ${ADGUARD_RELEASE} \
&& tar xvf ${ADGUARD_ARCHIVE} \
&& mkdir -p "${ADGUARD_DIR}" \
&& cp "AdGuardHome/AdGuardHome" "${ADGUARD_DIR}" \
&& chmod +x "${ADGUARD_DIR}/AdGuardHome" \
&& rm -rf "AdGuardHome" \
&& rm ${ADGUARD_ARCHIVE}
# Expose DNS port 53
EXPOSE 53
# Expose UI port 3000
ARG ADGUARD_UI_HOST="0.0.0.0"
ENV ADGUARD_UI_HOST ${ADGUARD_UI_HOST}
ARG ADGUARD_UI_PORT="3000"
ENV ADGUARD_UI_PORT ${ADGUARD_UI_PORT}
EXPOSE ${ADGUARD_UI_PORT}
# Run AdGuardHome
WORKDIR ${ADGUARD_DIR}
VOLUME ${ADGUARD_DIR}
ENTRYPOINT ./AdGuardHome --host ${ADGUARD_UI_HOST} --port ${ADGUARD_UI_PORT}

15
Dockerfile.travis Normal file
View File

@ -0,0 +1,15 @@
FROM alpine:latest
LABEL maintainer="AdGuard Team <devteam@adguard.com>"
# Update CA certs
RUN apk --no-cache --update add ca-certificates && \
rm -rf /var/cache/apk/*
COPY ./AdGuardHome /AdGuardHome
EXPOSE 53 3000
VOLUME /data
ENTRYPOINT ["/AdGuardHome"]
CMD ["-h", "0.0.0.0"]

65
build_docker.sh Normal file
View File

@ -0,0 +1,65 @@
#!/usr/bin/env bash
set -eE
set -o pipefail
set -x
DOCKERFILE="Dockerfile.travis"
if [ "${TRAVIS_BRANCH}" == "master" ]
then
VERSION="latest"
else
VERSION=`git describe --abbrev=4 --dirty --always --tags`
fi
build_image() {
from="$(awk '$1 == toupper("FROM") { print $2 }' ${DOCKERFILE})"
# See https://hub.docker.com/r/multiarch/alpine/tags
case "${GOARCH}" in
arm64)
alpineArch='arm64-edge'
imageArch='arm64'
;;
arm)
alpineArch='armhf-edge'
imageArch='armhf'
;;
386)
alpineArch='i386-edge'
imageArch='i386'
;;
amd64)
alpineArch='amd64-edge'
;;
*)
alpineArch='amd64-edge'
;;
esac
if [ "${GOOS}" == "linux" ] && [ "${GOARCH}" == "amd64" ]
then
image="adguard/adguardhome:${VERSION}"
else
image="adguard/adguardhome:${imageArch}-${VERSION}"
fi
make cleanfast; CGO_DISABLED=1 make
docker pull "multiarch/alpine:${alpineArch}"
docker tag "multiarch/alpine:${alpineArch}" "$from"
docker build -t "${image}" -f ${DOCKERFILE} .
docker push ${image}
docker rmi "$from"
}
# prepare qemu
docker run --rm --privileged multiarch/qemu-user-static:register --reset
make clean
# Prepare releases
GOOS=linux GOARCH=amd64 build_image
GOOS=linux GOARCH=386 build_image
GOOS=linux GOARCH=arm GOARM=6 build_image
GOOS=linux GOARCH=arm64 GOARM=6 build_image