We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在 coredns_custom_build 中, 没搜索到docker关键字, 于是过来问问
coredns_custom_build
下边是我的 docker-compose.yaml 文件, 使用的是官方的镜像 coredns/coredns
docker-compose.yaml
coredns/coredns
services: coredns: container_name: coredns restart: always volumes: - ./data:/etc/coredns ports: - 53:53/udp image: coredns/coredns command: -conf /etc/coredns/Corefile environment: - TZ=Asia/Shanghai
最近我想让coredns支持ads功能, 在这里找到了 由于其没有构建docker镜像, 我尝试自己构建, 下边是参考脚本
coredns
#!/bin/bash # Step 1: Fetch the webpage content URL="https://coredns.minidump.info/dl/coredns-linux-amd64.zip" WEBPAGE=$(curl -s $URL) # Step 2: Parse the download URL from the webpage content # Assuming the download link is directly provided in the URL DOWNLOAD_URL=$(echo "$WEBPAGE" | grep -oP '(?<=href=")[^"]*coredns-linux-amd64.zip') # If the DOWNLOAD_URL is relative, prepend the base URL if [[ $DOWNLOAD_URL != http* ]]; then BASE_URL=$(echo $URL | grep -oP 'https?://[^/]+') DOWNLOAD_URL="$BASE_URL/$DOWNLOAD_URL" fi # Step 3: Download the file using wget or curl wget -O coredns-linux-amd64.zip "$DOWNLOAD_URL" # or # curl -o coredns-linux-amd64.zip "$DOWNLOAD_URL" echo "Downloaded to coredns-linux-amd64.zip" unzip -d . coredns-linux-amd64.zip cd coredns-linux-amd64 curl -ssLO https://github.com/coredns/coredns/raw/master/Dockerfile docker buildx create --use --name coredns-env-builder docker buildx build --platform linux/amd64 -t coredns-custom .
因网络环境问题, 后面把脚本移植成workflow放在Actions中执行构建
workflow
Actions
name: Build and Publish on: workflow_dispatch: jobs: build-and-publish: runs-on: ubuntu-latest - name: Get CoreDNS download URL id: get-url run: | URL="https://coredns.minidump.info/dl/coredns-linux-amd64.zip" WEBPAGE=$(curl -s $URL) DOWNLOAD_URL=$(echo "$WEBPAGE" | grep -oP '(?<=href=")[^"]*coredns-linux-amd64.zip') echo "::set-output name=download_url::$DOWNLOAD_URL" - name: Download CoreDNS binary run: | curl -s -L -o coredns-linux-amd64.zip "${{ steps.get-url.outputs.download_url }}" - name: Unzip CoreDNS binary run: | unzip -d . coredns-linux-amd64.zip - name: Download Dockerfile run: | curl -s -L -o coredns-linux-amd64/Dockerfile https://github.com/coredns/coredns/raw/master/Dockerfile - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Log in to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Build and push Docker image run: | cd coredns-linux-amd64 docker buildx build --platform linux/amd64 -t ${{ secrets.DOCKER_USERNAME }}/coredns-custom:latest --push .
最终得到 coredns-custom 镜像, 一切正常
coredns-custom
希望老师能支持构建Docker镜像,感谢
The text was updated successfully, but these errors were encountered:
No branches or pull requests
在
coredns_custom_build
中, 没搜索到docker关键字, 于是过来问问下边是我的
docker-compose.yaml
文件, 使用的是官方的镜像coredns/coredns
最近我想让
coredns
支持ads功能, 在这里找到了由于其没有构建docker镜像, 我尝试自己构建, 下边是参考脚本
因网络环境问题, 后面把脚本移植成
workflow
放在Actions
中执行构建最终得到
coredns-custom
镜像, 一切正常希望老师能支持构建Docker镜像,感谢
The text was updated successfully, but these errors were encountered: