-
Notifications
You must be signed in to change notification settings - Fork 462
Introducing Just scripts #5171
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
base: develop
Are you sure you want to change the base?
Introducing Just scripts #5171
Changes from all commits
0991f6f
3cd1331
366ac30
482dc4f
1238d56
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| name: 'Install Dependencies' | ||
| description: 'Sets up common tools and dependencies used across workflows' | ||
| inputs: | ||
| install-just: | ||
| description: 'Install Just task runner' | ||
| required: false | ||
| default: 'true' | ||
| install-uv: | ||
| description: 'Install uv package manager' | ||
| required: false | ||
| default: 'true' | ||
| just-version: | ||
| description: 'Version of Just to install' | ||
| required: false | ||
| default: '1.21.0' | ||
| uv-cache-dependency-glob: | ||
| description: 'Glob pattern for uv cache dependency files' | ||
| required: false | ||
| default: '' | ||
| uv-version: | ||
| description: 'Version of uv to install' | ||
| required: false | ||
| default: '0.9.7' | ||
| python-version: | ||
| description: 'Python version' | ||
| required: false | ||
| default: '3.13' | ||
|
|
||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - name: Install Just | ||
| if: ${{ inputs.install-just == 'true' }} | ||
| uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3.0.0 | ||
| with: | ||
| just-version: ${{ inputs.just-version }} | ||
|
|
||
| - name: Install uv | ||
| if: ${{ inputs.install-uv == 'true' }} | ||
| uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6 | ||
| with: | ||
| version: ${{ inputs.uv-version }} | ||
| enable-cache: ${{ inputs.uv-cache-dependency-glob != '' && 'true' || 'false' }} | ||
| cache-dependency-glob: ${{ inputs.uv-cache-dependency-glob }} | ||
| python-version: ${{ inputs.python-version }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| #!/usr/bin/env just --justfile | ||
| import "recipes.justfile" | ||
|
|
||
| # Use bash as the shell for evaluating backtick expressions | ||
| set shell := ["bash", "-cu"] | ||
|
|
||
| # ------------------------------------------------------------------------------------------------- | ||
| # Runtime variables | ||
| # ------------------------------------------------------------------------------------------------- | ||
| port := "7860" | ||
| ui-port := "3000" | ||
| webcam-device := "/dev/video0" | ||
| data-dir := "" | ||
| host := "0.0.0.0" | ||
| webrtc-ports := "50000-51000" | ||
| device := "cpu" # cpu, cuda, xpu | ||
|
|
||
| # ------------------------------------------------------------------------------------------------- | ||
| # Variables used in the Justfile to build in Docker image | ||
| # ------------------------------------------------------------------------------------------------- | ||
| docker-build-context := "" | ||
| build-target := "cpu" # options: cpu, gpu, xpu | ||
| component-name := "geti-tune" | ||
| container-registry := 'localhost:5000/open-edge-platform' | ||
|
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. Why this won't target our default ghcr registry that we will push images to? Or at least dev ghcr registry?
Contributor
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. This is done similar to Geti Prompt. But I can change it if needed |
||
| version := "latest" | ||
| image-name := container-registry / component-name / build-target + ":" + version | ||
|
|
||
| host-ip := `uv run python -c "import socket; s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM); s.connect(('8.8.8.8',80)); print(s.getsockname()[0]); s.close()"` | ||
|
|
||
| docker-build-args := "--build-arg http_proxy --build-arg https_proxy --build-arg no_proxy --build-arg HTTP_PROXY --build-arg HTTPS_PROXY --build-arg NO_PROXY" | ||
| docker-run-args := "--env http_proxy --env https_proxy --env no_proxy --env HTTP_PROXY --env HTTPS_PROXY --env NO_PROXY" | ||
|
Comment on lines
+30
to
+31
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. Why by default are we adding proxy args/envs to docker build cmd? Will our builders be behind some proxy?
Contributor
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. Similar to previous comment - this is similar approach with Geti Prompt |
||
|
|
||
| # Run both backend and frontend development servers | ||
| dev: | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| export PUBLIC_API_URL="http://{{ host-ip }}:{{ port }}" | ||
|
|
||
| (cd backend && just port={{ port }} host={{ host }} device={{ device }} dev) & | ||
| (cd ui && npm install && PORT={{ ui-port }} npm start) & | ||
|
|
||
| wait | ||
|
|
||
| # Build geti tune with optional port mapping | ||
| build-image: | ||
| @echo "Building docker image for component: {{ component-name }}" | ||
| @docker build \ | ||
| {{ docker-build-args }} \ | ||
| {{ docker-build-context }} \ | ||
| --tag "{{ image-name }}" \ | ||
| --file docker/Dockerfile . \ | ||
| --target geti-tune-{{ build-target }} | ||
|
|
||
| # launch geti tune with optional webcam, volume and port mapping | ||
| run-image: build-image | ||
| @echo "Running docker image for component: {{ component-name }} with build-target: {{ build-target }}" | ||
| @echo "Proxy args: {{ docker-run-args }}" | ||
| @docker run --rm \ | ||
| {{ docker-run-args }} \ | ||
| --sysctl net.ipv4.ip_local_port_range="{{ replace(webrtc-ports, '-', ' ') }}" \ | ||
| --publish {{ webrtc-ports }}:{{ webrtc-ports }}/udp \ | ||
| --publish {{ port }}:{{ port }} \ | ||
| --env PORT={{ port }} \ | ||
| --env HOST={{ host }} \ | ||
| --env WEBRTC_ADVERTISE_IP='{{ host-ip }}' \ | ||
| {{ if data-dir != "" { " --volume " + data-dir + ":/geti_prompt/data" } else { "" } }} \ | ||
| {{ if path_exists(webcam-device) == "true" { " --device " + webcam-device + ":" + webcam-device } else { "" } }} \ | ||
| --name "{{ component-name }}-{{ version }}" \ | ||
| "{{ image-name }}" | ||
Uh oh!
There was an error while loading. Please reload this page.