feat: Make coyote available as a docker image
This commit is contained in:
@@ -8,9 +8,9 @@ on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
bump_type:
|
||||
description: "Specify the type of version bump"
|
||||
description: 'Specify the type of version bump'
|
||||
required: true
|
||||
default: "patch"
|
||||
default: 'patch'
|
||||
type: choice
|
||||
options:
|
||||
- patch
|
||||
@@ -46,7 +46,7 @@ jobs:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.10"
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install Commitizen
|
||||
run: |
|
||||
@@ -163,28 +163,28 @@ jobs:
|
||||
- target: aarch64-unknown-linux-musl
|
||||
os: ubuntu-latest
|
||||
use-cross: true
|
||||
cargo-flags: ""
|
||||
cargo-flags: ''
|
||||
- target: aarch64-apple-darwin
|
||||
os: macos-latest
|
||||
use-cross: true
|
||||
cargo-flags: ""
|
||||
cargo-flags: ''
|
||||
- target: aarch64-pc-windows-msvc
|
||||
os: windows-latest
|
||||
use-cross: true
|
||||
cargo-flags: ""
|
||||
cargo-flags: ''
|
||||
- target: x86_64-apple-darwin
|
||||
os: macos-latest
|
||||
cargo-flags: ""
|
||||
cargo-flags: ''
|
||||
- target: x86_64-pc-windows-msvc
|
||||
os: windows-latest
|
||||
cargo-flags: ""
|
||||
cargo-flags: ''
|
||||
- target: x86_64-unknown-linux-musl
|
||||
os: ubuntu-latest
|
||||
use-cross: true
|
||||
cargo-flags: ""
|
||||
cargo-flags: ''
|
||||
- target: x86_64-unknown-linux-gnu
|
||||
os: ubuntu-latest
|
||||
cargo-flags: ""
|
||||
cargo-flags: ''
|
||||
|
||||
steps:
|
||||
- name: Check if actor is repository owner
|
||||
@@ -338,7 +338,7 @@ jobs:
|
||||
${{ steps.package.outputs.archive }}
|
||||
${{ steps.package.outputs.sha }}
|
||||
tag_name: v${{ env.RELEASE_VERSION }}
|
||||
name: "v${{ env.RELEASE_VERSION }}"
|
||||
name: 'v${{ env.RELEASE_VERSION }}'
|
||||
body_path: artifacts/changelog.md
|
||||
prerelease: false
|
||||
|
||||
@@ -455,4 +455,64 @@ jobs:
|
||||
- uses: katyo/publish-crates@v2
|
||||
if: env.ACT != 'true'
|
||||
with:
|
||||
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||
|
||||
publish-sandbox-image:
|
||||
needs: [publish-github-release]
|
||||
name: Publish Sandbox Docker Image
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check if actor is repository owner
|
||||
if: ${{ github.actor != github.repository_owner && env.ACT != 'true' }}
|
||||
run: |
|
||||
echo "You are not authorized to run this workflow."
|
||||
exit 1
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Ensure repository is up-to-date
|
||||
if: env.ACT != 'true'
|
||||
run: |
|
||||
git fetch --all
|
||||
git pull
|
||||
|
||||
- name: Get release artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
merge-multiple: true
|
||||
|
||||
- name: Set version variable
|
||||
run: |
|
||||
version="$(cat artifacts/release-version)"
|
||||
echo "version=$version" >> $GITHUB_ENV
|
||||
|
||||
- name: Validate release environment variables
|
||||
run: |
|
||||
echo "Release version: ${{ env.version }}"
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
if: env.ACT != 'true'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Push to Docker Hub
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ env.ACT != 'true' }}
|
||||
tags: darkalex17/coyote:latest, darkalex17/coyote:${{ env.version }}
|
||||
build-args: COYOTE_VERSION=${{ env.version }}
|
||||
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
ARG COYOTE_VERSION
|
||||
FROM docker/sandbox-templates:shell-docker
|
||||
|
||||
ARG COYOTE_VERSION
|
||||
ARG TARGETARCH
|
||||
|
||||
ENV PATH="/home/agent/.cargo/bin:/home/agent/.local/bin:${PATH}"
|
||||
|
||||
USER root
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
jq curl git \
|
||||
build-essential pkg-config \
|
||||
cmake \
|
||||
clang libclang-dev \
|
||||
musl-tools \
|
||||
libssl-dev \
|
||||
pandoc \
|
||||
bzip2 \
|
||||
nano && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN set -euo pipefail; \
|
||||
USQL_VERSION=0.21.4; \
|
||||
case "${TARGETARCH}" in \
|
||||
amd64) USQL_ARCH=amd64 ;; \
|
||||
arm64) USQL_ARCH=arm64 ;; \
|
||||
*) echo "Unsupported TARGETARCH: ${TARGETARCH}" >&2; exit 1 ;; \
|
||||
esac; \
|
||||
TMPDIR=$(mktemp -d); \
|
||||
curl -fsSL --retry 3 \
|
||||
"https://github.com/xo/usql/releases/download/v${USQL_VERSION}/usql_static-${USQL_VERSION}-linux-${USQL_ARCH}.tar.bz2" \
|
||||
-o "$TMPDIR/usql.tar.bz2"; \
|
||||
tar -xjf "$TMPDIR/usql.tar.bz2" -C "$TMPDIR"; \
|
||||
install -m 0755 "$TMPDIR/usql_static" /usr/local/bin/usql; \
|
||||
rm -rf "$TMPDIR"
|
||||
|
||||
USER 1000
|
||||
|
||||
RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \
|
||||
printf '#!/bin/sh\nexec uv tool run "$@"\n' > "$HOME/.local/bin/uvx" && \
|
||||
chmod +x "$HOME/.local/bin/uvx"
|
||||
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
|
||||
sh -s -- -y --default-toolchain stable --profile minimal && \
|
||||
. "$HOME/.cargo/env" && \
|
||||
cargo install --locked iwec && \
|
||||
cargo install --locked ast-grep
|
||||
|
||||
USER root
|
||||
|
||||
RUN set -euo pipefail; \
|
||||
case "${TARGETARCH}" in \
|
||||
amd64) MUSL_TARGET=x86_64-unknown-linux-musl ;; \
|
||||
arm64) MUSL_TARGET=aarch64-unknown-linux-musl ;; \
|
||||
*) echo "Unsupported TARGETARCH: ${TARGETARCH}" >&2; exit 1 ;; \
|
||||
esac; \
|
||||
TMPDIR=$(mktemp -d); \
|
||||
curl -fsSL --retry 3 \
|
||||
"https://github.com/Dark-Alex-17/coyote/releases/download/v${COYOTE_VERSION}/coyote-${MUSL_TARGET}.tar.gz" \
|
||||
-o "$TMPDIR/coyote.tar.gz"; \
|
||||
tar -xzf "$TMPDIR/coyote.tar.gz" -C "$TMPDIR"; \
|
||||
install -m 0755 "$TMPDIR/coyote" /home/agent/.cargo/bin/coyote; \
|
||||
chown 1000:1000 /home/agent/.cargo/bin/coyote; \
|
||||
rm -rf "$TMPDIR"
|
||||
|
||||
USER 1000
|
||||
|
||||
ENTRYPOINT ["coyote"]
|
||||
@@ -100,6 +100,32 @@ To upgrade `coyote` using Homebrew:
|
||||
brew upgrade coyote
|
||||
```
|
||||
|
||||
### Docker
|
||||
Coyote is available as a Docker image on Docker Hub (`darkalex17/coyote`) for Linux amd64 and arm64.
|
||||
Useful for CI, ephemeral environments, or anywhere you prefer not to install it natively.
|
||||
|
||||
```bash
|
||||
docker pull darkalex17/coyote
|
||||
docker run --rm -it darkalex17/coyote
|
||||
```
|
||||
|
||||
To persist your configuration across container runs, mount your existing config directory:
|
||||
|
||||
```bash
|
||||
docker run --rm -it \
|
||||
-v ~/.config/coyote:/home/agent/.config/coyote \
|
||||
darkalex17/coyote
|
||||
```
|
||||
|
||||
If you use the local vault provider and want your vault credentials available in the container, also mount the password file:
|
||||
|
||||
```bash
|
||||
docker run --rm -it \
|
||||
-v ~/.config/coyote:/home/agent/.config/coyote \
|
||||
-v ~/.coyote_password:/home/agent/.coyote_password:ro \
|
||||
darkalex17/coyote
|
||||
```
|
||||
|
||||
### Scripts
|
||||
#### Linux/MacOS (`bash`)
|
||||
You can use the following command to run a bash script that downloads and installs the latest version of `coyote` for your
|
||||
|
||||
Reference in New Issue
Block a user