Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM alpine:latest
WORKDIR /app
COPY . .
RUN apk add --no-cache python3 py3-pip python3-dev patchelf build-base libffi-dev
RUN pip3 install -U nuitka --break-system-packages
RUN .build/nuitka.cmd

FROM alpine:latest
LABEL maintainer="NN708, newfuture"
WORKDIR /ddns
COPY --from=0 /app/.build/entrypoint.sh /
COPY --from=0 /app/dist/ddns /bin/
ENTRYPOINT [ "/entrypoint.sh" ]
5 changes: 3 additions & 2 deletions entrypoint.sh → .build/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

if [ $# -eq 0 ]; then
printenv > /etc/environment
echo "*/5 * * * * /ddns -c /config.json" > /etc/crontabs/root
echo "*/5 * * * * cd /ddns && /bin/ddns" > /etc/crontabs/root
/bin/ddns
exec crond -f
else
first=`echo $1 | cut -c1`
if [ "$first" = "-" ]; then
exec /ddns $@
exec /bin/ddns $@
else
exec $@
fi
Expand Down
2 changes: 1 addition & 1 deletion .build/nuitka.cmd
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nuitka --standalone --onefile --output-dir=./dist --output-filename=ddns --remove-output --include-module=dns.dnspod --include-module=dns.alidns --include-module=dns.dnspod_com --include-module=dns.dnscom --include-module=dns.cloudflare --include-module=dns.he --include-module=dns.huaweidns --include-module=dns.callback --macos-app-name="DDNS" --product-name=DDNS --file-description="DDNS Client 自动更新域名解析到本机IP" --company-name="New Future" --copyright="https://ddns.newfuture.cc" --windows-icon-from-ico="favicon.ico" --linux-icon=".build/icon.png" --macos-app-icon=".build/icon.png" --assume-yes-for-downloads run.py
nuitka run.py --standalone --onefile --output-dir=./dist --no-deployment-flag=self-execution --output-filename=ddns --remove-output --include-module=dns.dnspod --include-module=dns.alidns --include-module=dns.dnspod_com --include-module=dns.dnscom --include-module=dns.cloudflare --include-module=dns.he --include-module=dns.huaweidns --include-module=dns.callback --product-name=DDNS --file-description="DDNS Client 自动更新域名解析到本机IP" --company-name="New Future" --copyright="https://ddns.newfuture.cc" --windows-icon-from-ico="favicon.ico" --assume-yes-for-downloads --lto=yes
10 changes: 6 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,14 @@ jobs:
if: runner.os == 'Linux'
run: |
sudo apt-get update && sudo apt install -y patchelf ccache
echo " --static-libpython=yes --linux-icon=.build/icon.png" >> .build/nuitka.cmd
cp /etc/ssl/certs/ca-certificates.crt cert.pem && export SSL_CERT_FILE=${PWD}/cert.pem

- name: setup on macOS
if: runner.os == 'macOS'
run: |
python3 -m pip install imageio

echo " --macos-app-name=DDNS --macos-app-icon=.build/icon.png" >> .build/nuitka.cmd

- run: python ./run.py -h

Expand All @@ -154,6 +155,7 @@ jobs:
with:
context: .
load: true
file: .build/Dockerfile
tags: ddns:test
- name: test help command
run: docker run --rm ddns:test -h
Expand Down Expand Up @@ -183,14 +185,13 @@ jobs:
preview-docker:
runs-on: ubuntu-latest
if: github.event_name == 'push'
timeout-minutes: 5
timeout-minutes: 12
needs: [docker]
environment:
name: preview
url: https://github.com/NewFuture/DDNS/pkgs/container/ddns/?tag=master
env:
arch: linux/amd64,linux/arm,linux/arm64
# arch: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/riscv64,linux/s390x
arch: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/riscv64,linux/s390x
permissions:
packages: write
steps:
Expand Down Expand Up @@ -218,6 +219,7 @@ jobs:
- uses: docker/build-push-action@v6
with:
context: .
file: .build/Dockerfile
platforms: ${{ env.arch }}
push: true
tags: ${{ steps.meta.outputs.tags }}
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ permissions:
jobs:
publish-docker:
runs-on: ubuntu-latest
timeout-minutes: 5
timeout-minutes: 15
environment:
name: publish
url: https://hub.docker.com/r/newfuture/ddns
permissions:
packages: write
env:
DOCKER_BUILD_RECORD_UPLOAD: false
arch: linux/amd64,linux/arm,linux/arm64
# arch: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/riscv64,linux/s390x
arch: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/riscv64,linux/s390x
steps:
- uses: actions/checkout@v4
- run: sed -i -e "s#\${BUILD_VERSION}#${{ github.ref_name }}#" -e "s/\${BUILD_DATE}/$(date --iso-8601=seconds)/" run.py
Expand All @@ -45,6 +44,7 @@ jobs:
- uses: docker/build-push-action@v6
with:
context: .
file: .build/Dockerfile
platforms: ${{ env.arch }}
push: true
tags: ${{ steps.meta.outputs.tags }}
Expand Down Expand Up @@ -98,12 +98,14 @@ jobs:
if: runner.os == 'Linux'
run: |
apt-get update && apt install -y patchelf ccache
echo " --static-libpython=yes --linux-icon=.build/icon.png" >> .build/nuitka.cmd
cp /etc/ssl/certs/ca-certificates.crt cert.pem && export SSL_CERT_FILE=${PWD}/cert.pem

- name: setup on macOS
if: runner.os == 'macOS'
run: |
python3 -m pip install imageio
echo " --macos-app-name=DDNS --macos-app-icon=.build/icon.png" >> .build/nuitka.cmd

- name: Package binary
run: ./.build/nuitka.cmd
Expand Down
10 changes: 0 additions & 10 deletions Dockerfile

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
- [x] 多系统兼容 ![cross platform](https://img.shields.io/badge/platform-windows_%7C%20linux_%7C%20osx-success.svg?style=social)
- [x] python3 支持 ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ddns.svg?style=social)(2.x支持python2和python3)
- [x] PIP 安装 ![PyPI - Wheel](https://img.shields.io/pypi/wheel/ddns.svg?style=social)
- [x] Docker 支持(@NN708)
- [x] Docker 支持(@NN708)
- 域名支持:
- [x] 多个域名支持
- [x] 多级域名解析
Expand Down Expand Up @@ -71,10 +71,10 @@
--network host \
newfuture/ddns
```
- 使用配置文件:
- 使用配置文件(docker 工作目录`/ddds/`,默认配置位置`/ddns/config.json`)
```
docker run -d \
-v /path/to/config.json:/config.json \
-v /local/config/path/:/ddns/ \
--network host \
newfuture/ddns
```
Expand Down
3 changes: 1 addition & 2 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
@author: New Future
@modified: rufengsuixing
"""
# nuitka-project-if: {OS} == "Linux":
# nuitka-project: --static-libpython=yes

# nuitka-project-if: os.getenv("BUILD_VERSION") is not None:
# nuitka-project: --product-version=${BUILD_VERSION}
# nuitka-project-else:
Expand Down
Loading