From 73de48c6ef50112c1e6f72506de4c700d615ef38 Mon Sep 17 00:00:00 2001 From: Bohdan Shulha Date: Fri, 8 Nov 2024 13:06:01 +0100 Subject: [PATCH] feat: #12 support builds with nixpacks --- .github/workflows/labeler.yml | 18 ------------------ bin/nixpacks_build.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 18 deletions(-) delete mode 100644 .github/workflows/labeler.yml create mode 100644 bin/nixpacks_build.sh diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml deleted file mode 100644 index bde5f72..0000000 --- a/.github/workflows/labeler.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: "Issue Labeler" -on: - issues: - types: [opened] - -permissions: - issues: write - contents: read - -jobs: - triage: - runs-on: ubuntu-latest - steps: - - uses: github/issue-labeler@v3.4 - with: - configuration-path: .github/labeler.yml - enable-versioned-regex: 0 - repo-token: ${{ github.token }} diff --git a/bin/nixpacks_build.sh b/bin/nixpacks_build.sh new file mode 100644 index 0000000..bca77f8 --- /dev/null +++ b/bin/nixpacks_build.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +set -e + +. "$(dirname "$0")/../lib/validate.sh" +. "$(dirname "$0")/../lib/sync.sh" + + +check_var TARGET_DIR +check_var NIXPACKS_FILE_PATH +check_var IMAGE_NAME + +# Create a temporary build directory +BUILD_DIR=$(mktemp -d) +trap 'rm -rf "$BUILD_DIR"' EXIT + +function copy_files() { + cp -r "$TARGET_DIR"/* "$BUILD_DIR" +} + +with_lock "${TARGET_DIR}" copy_files + +# Change to the build directory +cd "$BUILD_DIR" + +nixpacks build --config "$NIXPACKS_FILE_PATH" --name "$IMAGE_NAME" . + +# Push the image to the registry +docker push "${IMAGE_NAME}"