-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add docker release and local bun #49
New issue
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
Open
Exeloo
wants to merge
3
commits into
main
Choose a base branch
from
feat/add-docker-ci
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #!/bin/sh | ||
| set -e | ||
|
|
||
| # Run command with nf if the first argument contains a "-" or is not a system command. The last | ||
| # part inside the "{}" is a workaround for the following bug in ash/dash: | ||
| # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=874264 | ||
| if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ] || { [ -f "${1}" ] && ! [ -x "${1}" ]; }; then | ||
| set -- nf "$@" | ||
| fi | ||
|
|
||
| exec "$@" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #!/bin/sh | ||
| basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") | ||
|
|
||
| case `uname` in | ||
| *CYGWIN*|*MINGW*|*MSYS*) | ||
| if command -v cygpath > /dev/null 2>&1; then | ||
| basedir=`cygpath -w "$basedir"` | ||
| fi | ||
| ;; | ||
| esac | ||
|
|
||
| if [ -z "$NODE_PATH" ]; then | ||
| export NODE_PATH="/usr/nanoforge/node_modules" | ||
| else | ||
| export NODE_PATH="/usr/nanoforge/node_modules:$NODE_PATH" | ||
| fi | ||
| if [ -x "$basedir/node" ]; then | ||
| exec "$basedir/node" "$basedir/cli/dist/nf.js" "$@" | ||
| else | ||
| exec node "$basedir/cli/dist/nf.js" "$@" | ||
| fi | ||
|
Comment on lines
+1
to
+21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cant we just use a release version of nanoforge instead of that ?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what do you mean by that ? |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name: prepare | ||
| description: Prepare action | ||
| inputs: | ||
| node-install: | ||
| description: Install node | ||
| default: "true" | ||
| pnpm-install: | ||
| description: Install pnpm depedencies | ||
| default: "true" | ||
| build: | ||
| description: Build packages | ||
| default: "true" | ||
| runs: | ||
| using: composite | ||
| steps: | ||
| - if: inputs.node-install == 'true' | ||
| name: Install Node.js v25 | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 25 | ||
| package-manager-cache: false | ||
| registry-url: https://registry.npmjs.org | ||
|
|
||
| - if: inputs.pnpm-install == 'true' | ||
| name: Install dependencies | ||
| uses: ./.github/actions/pnpm-install | ||
|
|
||
| - if: inputs.build == 'true' | ||
| name: Build packages | ||
| shell: bash | ||
| run: pnpm run build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| name: Pre-Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: "New version of the package (leave empty for auto generated version)" | ||
| type: string | ||
| required: false | ||
| dry_run: | ||
| description: Perform a dry run? | ||
| type: boolean | ||
| default: false | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| create-release-pr: | ||
| name: Create release pr | ||
| runs-on: ubuntu-latest | ||
| if: github.repository_owner == 'NanoForge-dev' | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| fetch-tags: true | ||
|
|
||
| - name: Prepare | ||
| uses: ./.github/actions/prepare | ||
|
|
||
| - name: Release packages | ||
| uses: ./node_modules/@nanoforge-dev/actions/dist/create-release-pr | ||
| with: | ||
| package: "@nanoforge-dev/cli" | ||
| version: ${{ inputs.version }} | ||
| dry: ${{ inputs.dry_run }} | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| name: Release Docker | ||
|
|
||
| on: | ||
| release: | ||
| types: | ||
| - published | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| env: | ||
| IMAGE_NAME: nanoforge/cli | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build ${{ matrix.platform }} | ||
| runs-on: ${{ matrix.runner }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - platform: linux/amd64 | ||
| runner: ubuntu-latest | ||
| - platform: linux/arm64 | ||
| runner: ubuntu-24.04-arm | ||
| steps: | ||
| - name: Prepare | ||
| run: | | ||
| platform=${{ matrix.platform }} | ||
| echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV | ||
|
|
||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Login to DockerHub | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| username: ${{ secrets.DOCKER_USERNAME }} | ||
| password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | ||
|
|
||
| - name: Build and push by digest | ||
| id: build | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| file: Dockerfile | ||
| platforms: ${{ matrix.platform }} | ||
| outputs: type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true | ||
|
|
||
| - name: Export digest | ||
| run: | | ||
| mkdir -p /tmp/digests | ||
| digest="${{ steps.build.outputs.digest }}" | ||
| touch "/tmp/digests/${digest#sha256:}" | ||
|
|
||
| - name: Upload digest | ||
| uses: actions/upload-artifact@v5 | ||
| with: | ||
| name: digests-${{ env.PLATFORM_PAIR }} | ||
| path: /tmp/digests/* | ||
| if-no-files-found: error | ||
| retention-days: 1 | ||
|
|
||
| merge: | ||
| name: Create and push manifest list | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| steps: | ||
| - name: Download digests | ||
| uses: actions/download-artifact@v6 | ||
| with: | ||
| path: /tmp/digests | ||
| pattern: digests-* | ||
| merge-multiple: true | ||
|
|
||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Version | ||
| id: version | ||
| run: | | ||
| VERSION=$(jq --raw-output '.version' package.json) | ||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Login to DockerHub | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| username: ${{ secrets.DOCKER_USERNAME }} | ||
| password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | ||
|
|
||
| - name: Create manifest list and push | ||
| working-directory: /tmp/digests | ||
| run: | | ||
| docker buildx imagetools create -t ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }} \ | ||
| $(printf '${{ env.IMAGE_NAME }}@sha256:%s ' *) | ||
|
|
||
| - name: Inspect image | ||
| run: | | ||
| docker buildx imagetools inspect ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name: Release Tag | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: | ||
| - closed | ||
| branches: | ||
| - main | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| create-release-tag: | ||
| name: Create release tag | ||
| runs-on: ubuntu-latest | ||
| if: github.repository_owner == 'NanoForge-dev' && github.event.pull_request.merged == true && startsWith(github.head_ref, 'releases/') | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Prepare | ||
| uses: ./.github/actions/prepare | ||
|
|
||
| - name: Create release tag | ||
| uses: ./node_modules/@nanoforge-dev/actions/dist/create-release-tag | ||
| with: | ||
| commit: ${{ github.sha }} | ||
| branch: ${{ github.head_ref }} | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| name: Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| push: | ||
| branches: | ||
| - main | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| tests: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Prepare | ||
| uses: ./.github/actions/prepare | ||
|
|
||
| - name: Run linter | ||
| run: pnpm lint |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1 @@ | ||
| pnpm --no-install lint-staged | ||
| pnpm format |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| pnpm lint | ||
| pnpm build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 24.11.1 | ||
| 25 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| FROM node:25-alpine AS base | ||
|
|
||
| ENV PNPM_HOME="/pnpm" | ||
| ENV PATH="$PNPM_HOME:$PATH" | ||
| ENV CI=true | ||
|
|
||
| COPY . /usr/nanoforge | ||
| WORKDIR /usr/nanoforge | ||
|
|
||
| RUN npm --global install corepack@latest --force | ||
| RUN corepack enable | ||
|
|
||
| FROM base AS builder | ||
|
|
||
| RUN pnpm install --frozen-lockfile --ignore-scripts | ||
| RUN pnpm run build | ||
|
|
||
| FROM builder AS pruned | ||
|
|
||
| RUN pnpm --filter='@nanoforge-dev/cli' --prod deploy --legacy pruned | ||
|
|
||
| FROM node:25-alpine AS cli | ||
|
|
||
| WORKDIR /usr/nanoforge | ||
|
|
||
| RUN addgroup --system --gid 1001 nodejs | ||
| RUN adduser --system --uid 1001 nanoforge | ||
| USER nanoforge | ||
|
|
||
| COPY --from=pruned /usr/nanoforge/pruned cli | ||
| COPY .cloud/docker/nf /usr/nanoforge | ||
|
|
||
| COPY .cloud/docker/docker-entrypoint.sh /usr/local/bin | ||
|
|
||
| ENV NANOFORGE_HOME="/usr/nanoforge" | ||
| ENV PATH="$NANOFORGE_HOME:$PATH" | ||
|
|
||
| ENTRYPOINT ["docker-entrypoint.sh"] | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| CMD ["nf"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,3 @@ | ||
| import pluginJs from "@eslint/js"; | ||
| import eslintConfigPrettier from "eslint-config-prettier"; | ||
| import globals from "globals"; | ||
| import tseslint from "typescript-eslint"; | ||
| import eslintConfig from "@nanoforge-dev/utils-eslint-config"; | ||
|
|
||
| export default [ | ||
| { files: ["src/**/*.{ts}"] }, | ||
| { languageOptions: { globals: globals.node } }, | ||
|
|
||
| pluginJs.configs.recommended, | ||
| ...tseslint.configs.recommended, | ||
| ...tseslint.configs.strict, | ||
| eslintConfigPrettier, | ||
| { ignores: ["**/*.js", "**/*.d.ts", "dist/", ".cloud/", ".idea/"] }, | ||
| { | ||
| rules: { | ||
| "@typescript-eslint/no-extraneous-class": "off", | ||
| "@typescript-eslint/no-empty-object-type": "off", | ||
| "@typescript-eslint/no-explicit-any": "off", | ||
| "@typescript-eslint/ban-ts-comment": "off", | ||
| "@typescript-eslint/member-ordering": [ | ||
| "error", | ||
| { | ||
| default: [ | ||
| "static-field", | ||
| "field", | ||
| "public-static-method", | ||
| "constructor", | ||
| "method", | ||
| "protected-method", | ||
| "private-method", | ||
| ], | ||
| }, | ||
| ], | ||
| }, | ||
| }, | ||
| ]; | ||
| export default eslintConfig; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this useful ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To override the node docker entrypoint