From 54af2adbf2f433e80393fb142e66ba6b3a78b13e Mon Sep 17 00:00:00 2001 From: Ainar Garipov Date: Wed, 30 Dec 2020 14:34:02 +0300 Subject: [PATCH] all: remove old Dockerfile, improve build scripts --- .dockerignore | 1 + .github/workflows/build.yml | 13 +----- CHANGELOG.md | 8 ++-- Dockerfile | 83 ------------------------------------- scripts/make/clean.sh | 2 + 5 files changed, 10 insertions(+), 97 deletions(-) delete mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore index 4c4ef9a82f1..bdd388f30fa 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,3 @@ # Ignore everything except for explicitly allowed stuff. * +!dist/docker diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 999dd6a2225..1171b02ff3b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,7 +62,7 @@ 'with': 'token': '${{ secrets.CODECOV_TOKEN }}' 'file': './coverage.txt' - 'app': + 'build-release': 'runs-on': 'ubuntu-latest' 'needs': 'test' 'steps': @@ -96,16 +96,7 @@ - 'name': 'Set up Snapcraft' 'run': 'sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft' - 'name': 'Run snapshot build' - 'run': 'make SIGN=0 VERBOSE=2 js-deps js-build build-release' - - 'docker': - 'runs-on': 'ubuntu-latest' - 'needs': 'test' - 'steps': - - 'name': 'Checkout' - 'uses': 'actions/checkout@v2' - 'with': - 'fetch-depth': 0 + 'run': 'make SIGN=0 VERBOSE=1 js-deps js-build build-release' - 'name': 'Set up QEMU' 'uses': 'docker/setup-qemu-action@v1' - 'name': 'Set up Docker Buildx' diff --git a/CHANGELOG.md b/CHANGELOG.md index af6ede31f7d..e2fa248b297 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ and this project adheres to ## [Unreleased] ### Added @@ -44,11 +44,11 @@ and this project adheres to improve error response ([#2358]). - Improved HTTP requests handling and timeouts ([#2343]). - Our snap package now uses the `core20` image as its base ([#2306]). -- New build system and various internal improvements ([#2267], [#2271], +- New build system and various internal improvements ([#2276], [#2271], [#2297]). [#2231]: https://github.com/AdguardTeam/AdGuardHome/issues/2231 -[#2267]: https://github.com/AdguardTeam/AdGuardHome/issues/2267 +[#2276]: https://github.com/AdguardTeam/AdGuardHome/issues/2276 [#2271]: https://github.com/AdguardTeam/AdGuardHome/issues/2271 [#2297]: https://github.com/AdguardTeam/AdGuardHome/issues/2297 [#2306]: https://github.com/AdguardTeam/AdGuardHome/issues/2306 @@ -82,6 +82,8 @@ and this project adheres to ### Removed +- `Dockerfile` ([#2276]). Replaced with the script + `scripts/make/build-docker.sh` which uses `scripts/make/Dockerfile`. - Support for pre-v0.99.3 format of query logs ([#2102]). ## [v0.104.3] - 2020-11-19 diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 8317b2587ed..00000000000 --- a/Dockerfile +++ /dev/null @@ -1,83 +0,0 @@ -# NOTE: This Dockerfile is no longer supported and will be removed in -# AdGuard Home v0.106.0. For the new way we build our Docker images, -# see scripts/make/build-docker.sh and scripts/README.md. - -FROM --platform=${BUILDPLATFORM:-linux/amd64} tonistiigi/xx:golang AS xgo -FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.14-alpine as builder - -ARG BUILD_DATE -ARG VCS_REF -ARG VERSION=dev -ARG CHANNEL=release - -ENV CGO_ENABLED 0 -ENV GO111MODULE on -ENV GOPROXY https://goproxy.io - -COPY --from=xgo / / -RUN go env - -RUN apk --update --no-cache add \ - build-base \ - gcc \ - git \ - npm \ - yarn \ - && rm -rf /tmp/* /var/cache/apk/* - -WORKDIR /app - -COPY . ./ - -# Prepare the client code -RUN npm --prefix client ci && npm --prefix client run build-prod -RUN yarn --cwd client2 build - -# Download go dependencies -RUN go mod download -RUN go generate ./... - -# It's important to place TARGET* arguments here to avoid running npm and go mod download for every platform -ARG TARGETPLATFORM -ARG TARGETOS -ARG TARGETARCH -RUN go build -ldflags="-s -w -X main.version=${VERSION} -X main.channel=${CHANNEL} -X main.goarm=${GOARM}" - -FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:latest - -ARG BUILD_DATE -ARG VCS_REF -ARG VERSION -ARG CHANNEL - -LABEL maintainer="AdGuard Team " \ - org.opencontainers.image.created=$BUILD_DATE \ - org.opencontainers.image.url="https://adguard.com/adguard-home.html" \ - org.opencontainers.image.source="https://github.com/AdguardTeam/AdGuardHome" \ - org.opencontainers.image.version=$VERSION \ - org.opencontainers.image.revision=$VCS_REF \ - org.opencontainers.image.vendor="AdGuard" \ - org.opencontainers.image.title="AdGuard Home" \ - org.opencontainers.image.description="Network-wide ads & trackers blocking DNS server" \ - org.opencontainers.image.licenses="GPL-3.0" - -RUN apk --update --no-cache add \ - ca-certificates \ - libcap \ - libressl \ - && rm -rf /tmp/* /var/cache/apk/* - -COPY --from=builder --chown=nobody:nogroup /app/AdGuardHome /opt/adguardhome/AdGuardHome -COPY --from=builder --chown=nobody:nogroup /usr/local/go/lib/time/zoneinfo.zip /usr/local/go/lib/time/zoneinfo.zip - -RUN /opt/adguardhome/AdGuardHome --version \ - && mkdir -p /opt/adguardhome/conf /opt/adguardhome/work \ - && chown -R nobody: /opt/adguardhome \ - && setcap 'cap_net_bind_service=+eip' /opt/adguardhome/AdGuardHome - -EXPOSE 53/tcp 53/udp 67/udp 68/udp 80/tcp 443/tcp 853/tcp 3000/tcp -WORKDIR /opt/adguardhome/work -VOLUME ["/opt/adguardhome/conf", "/opt/adguardhome/work"] - -ENTRYPOINT ["/opt/adguardhome/AdGuardHome"] -CMD ["-h", "0.0.0.0", "-c", "/opt/adguardhome/conf/AdGuardHome.yaml", "-w", "/opt/adguardhome/work", "--no-check-update"] diff --git a/scripts/make/clean.sh b/scripts/make/clean.sh index 9556f02db40..a366e79c4d8 100644 --- a/scripts/make/clean.sh +++ b/scripts/make/clean.sh @@ -25,7 +25,9 @@ rm -f\ rm -f -r\ ./bin/\ ./build/\ + ./build2/\ ./client/node_modules/\ + ./client2/node_modules/\ ./data/\ "./${dist_dir}/"\ ;