Skip to content

Commit

Permalink
fix: napi docker run
Browse files Browse the repository at this point in the history
  • Loading branch information
greaka committed Jan 23, 2024
1 parent d3e90e7 commit 92d0288
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
8 changes: 6 additions & 2 deletions .github/actions/build-napi-artifact/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ inputs:
description: "node auth token"
npm_token:
description: "npm token"
shipyard:
description: "shipyard registry url"
shipyard_token:
description: "shipyard.rs token"
working-directory:
Expand Down Expand Up @@ -94,11 +96,13 @@ runs:
CARGO_HTTP_USER_AGENT: "shipyard ${{ inputs.shipyard_token }}"
SSH_AUTH_SOCK: /ssh-agent
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
SHIPYARD_REGISTRY: ${{ inputs.shipyard }}
SHIPYARD_TOKEN: ${{ inputs.shipyard_token }}
if: ${{ steps.check-version-exists.outputs.exists == 'false' && !contains(inputs.runner_os, 'windows') }}
with:
image: ${{ inputs.docker }}
options: --user 0:0 -w /build/${{ inputs.working-directory }} -v ${{ github.workspace }}:/build -v ${{ env.SSH_AUTH_SOCK }}:/ssh-agent -v ${{ steps.check-version-exists.outputs.home }}/.gitconfig:/root/.gitconfig -v ${{ steps.check-version-exists.outputs.home }}/.ssh:/root/.ssh:ro
run: ${{ inputs.docker_build }}
options: --user 0:0 -w /build/${{ inputs.working-directory }} -v ${{ github.workspace }}:/build -v ${{ env.SSH_AUTH_SOCK }}:/ssh-agent -v ${{ steps.check-version-exists.outputs.home }}/.gitconfig:/root/.gitconfig -v ${{ steps.check-version-exists.outputs.home }}/.ssh:/.ssh
run: /entrypoint.sh && ${{ inputs.docker_build }}

- name: Upload artifact
if: ${{ steps.check-version-exists.outputs.exists == 'false' && contains(inputs.runner_os, 'windows') }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build_napi_builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Build builder for napi crates

on:
workflow_dispatch:
push:
branches: napi

jobs:
build-rust-test-image:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/npm-napi-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ jobs:
runner_arch: ${{ matrix.os.arch }}
runner_extension: ${{ matrix.os.ext }}
docker: ghcr.io/foresightminingsoftwarecorporation/napi-rs-docker-builder:latest
docker_build: ls -ahl ~ && ls -ahl / && ls -ahl /root && ls -ahl ~/.ssh && yarn install && yarn build --target x86_64-unknown-linux-musl --js=false
docker_build: yarn install && yarn build --target x86_64-unknown-linux-musl --js=false
node_auth_token: ${{ secrets.GITHUB_TOKEN }}
npm_token: ${{ secrets.GH_REGISTRY_PACKAGES }}
shipyard: ${{ secrets.CARGO_PRIVATE_REGISTRY_NAME }}
shipyard_token: ${{ secrets.CARGO_PRIVATE_REGISTRY_TOKEN }}
working-directory: ${{ inputs.working-directory }}
bin: ${{ needs.check_release_npm.outputs.name }}
Expand Down
4 changes: 1 addition & 3 deletions docker/napi_builder/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@ chown -R root:root ~/.ssh

sed 's|/home/runner|/root|g' -i.bak ~/.ssh/config
chmod -R 600 ~/.ssh
cat ~/.ssh/config

# This will exec the CMD from your Dockerfile, i.e. "npm start"
exec "sh -c \"$@\""
cargo login --registry $SHIPYARD_REGISTRY $SHIPYARD_TOKEN

0 comments on commit 92d0288

Please sign in to comment.