diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..2c7d170 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/build_docker_image.yml b/.github/workflows/build_docker_image.yml new file mode 100644 index 0000000..a167d99 --- /dev/null +++ b/.github/workflows/build_docker_image.yml @@ -0,0 +1,50 @@ +name: Build docker image + +on: + push: + branches: + - 'main' + +jobs: + Build-Docker-Image: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v4 + + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - id: repository_name + uses: ASzc/change-string-case-action@v5 + with: + string: ${{ github.repository }} + + - + name: Login to ghcr.io + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - + name: Build and push + id: docker_build + uses: docker/build-push-action@v5 + env: + IMAGE: ${{ steps.repository_name.outputs.lowercase }} + with: + push: true + platforms: linux/amd64 + tags: ghcr.io/${{ env.IMAGE }}:latest + context: . + file: ./docker/build.dockerfile + + # - + # name: Invoke deployment hook + # uses: joelwmale/webhook-action@master + # with: + # url: ${{ secrets.WEBHOOK_URL }} diff --git a/docker/build.dockerfile b/docker/build.dockerfile new file mode 100644 index 0000000..f5ae0ec --- /dev/null +++ b/docker/build.dockerfile @@ -0,0 +1,21 @@ +FROM rust:bullseye AS builder + +WORKDIR /app + +COPY . . + +RUN cargo build --release --bin ionos-ddns + + +FROM debian:bullseye-slim + +RUN apt-get update \ + && apt-get install -y openssl ca-certificates \ + && rm -rf /var/lib/apt/lists/* + +RUN update-ca-certificates + +WORKDIR /app + +COPY --from=builder /app/target/release/ionos-ddns /usr/local/bin +ENTRYPOINT ["/usr/local/bin/ionos-ddns"]