Add docker build (#1)
This commit is contained in:
parent
18fd9d827b
commit
bf362afb98
46
.drone.yml
Normal file
46
.drone.yml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: kubernetes
|
||||||
|
name: Containeraztion latest
|
||||||
|
steps:
|
||||||
|
- name: Docker build
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 100
|
||||||
|
memory: 2048MiB
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- main
|
||||||
|
privileged: true
|
||||||
|
settings:
|
||||||
|
registry: git.badhouseplants.net
|
||||||
|
username: allanger
|
||||||
|
password:
|
||||||
|
from_secret: GITEA_TOKEN
|
||||||
|
repo: git.badhouseplants.net/badhouseplants/clever-install
|
||||||
|
tags: latest
|
||||||
|
platforms:
|
||||||
|
- linux/arm64
|
||||||
|
- linux/amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Docker build
|
||||||
|
image: thegeeklab/drone-docker-buildx
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 100
|
||||||
|
memory: 2048MiB
|
||||||
|
privileged: true
|
||||||
|
settings:
|
||||||
|
registry: git.badhouseplants.net
|
||||||
|
username: allanger
|
||||||
|
password:
|
||||||
|
from_secret: GITEA_TOKEN
|
||||||
|
repo: git.badhouseplants.net/badhouseplants/clever-install
|
||||||
|
tags: latest
|
||||||
|
platforms:
|
||||||
|
- linux/arm64
|
||||||
|
- linux/amd64
|
10
.github/workflows/build-version.yaml
vendored
10
.github/workflows/build-version.yaml
vendored
@ -21,7 +21,7 @@ jobs:
|
|||||||
target: aarch64-apple-darwin
|
target: aarch64-apple-darwin
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
@ -34,20 +34,20 @@ jobs:
|
|||||||
args: --release --all-features --target=${{ matrix.target }}
|
args: --release --all-features --target=${{ matrix.target }}
|
||||||
|
|
||||||
- name: Archive build artifacts
|
- name: Archive build artifacts
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: build-${{matrix.target}}
|
name: build-${{matrix.target}}
|
||||||
path: ${{ github.workspace }}/target/${{ matrix.target }}/release/clin
|
path: ${{ github.workspace }}/target/${{ matrix.target }}/release/dudo
|
||||||
|
|
||||||
release:
|
release:
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Download artifact
|
- name: Download artifact
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v3
|
||||||
|
|
||||||
- name: Set version variable
|
- name: Set version variable
|
||||||
run: echo "CLIN_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
|
run: echo "CLIN_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
|
||||||
|
10
.github/workflows/container-stable.yaml
vendored
10
.github/workflows/container-stable.yaml
vendored
@ -9,9 +9,11 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
containerization:
|
containerization:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
packages: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set action link variable
|
- name: Set action link variable
|
||||||
run: echo "LINK=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_ENV
|
run: echo "LINK=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_ENV
|
||||||
@ -26,14 +28,14 @@ jobs:
|
|||||||
uses: docker/setup-buildx-action@master
|
uses: docker/setup-buildx-action@master
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.CR_PAT }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
builder: ${{ steps.buildx.outputs.name }}
|
builder: ${{ steps.buildx.outputs.name }}
|
||||||
context: .
|
context: .
|
||||||
|
10
.github/workflows/container-version.yaml
vendored
10
.github/workflows/container-version.yaml
vendored
@ -9,9 +9,11 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
containerization:
|
containerization:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
packages: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set version variable
|
- name: Set version variable
|
||||||
run: echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
|
run: echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
|
||||||
@ -29,14 +31,14 @@ jobs:
|
|||||||
uses: docker/setup-buildx-action@master
|
uses: docker/setup-buildx-action@master
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.CR_PAT }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
builder: ${{ steps.buildx.outputs.name }}
|
builder: ${{ steps.buildx.outputs.name }}
|
||||||
context: .
|
context: .
|
||||||
|
18
.github/workflows/tests.yaml
vendored
18
.github/workflows/tests.yaml
vendored
@ -9,27 +9,11 @@ on:
|
|||||||
- "src/**"
|
- "src/**"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cargo_udeps:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: nightly
|
|
||||||
|
|
||||||
- name: Install cargo-udeps
|
|
||||||
run: cargo install cargo-udeps --locked
|
|
||||||
|
|
||||||
- name: Check dependencies
|
|
||||||
run: cargo +nightly udeps
|
|
||||||
|
|
||||||
cargo_test:
|
cargo_test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
|
25
.github/workflows/udeps_test.yaml
vendored
Normal file
25
.github/workflows/udeps_test.yaml
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
name: "Tests"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
cargo_udeps:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: nightly
|
||||||
|
|
||||||
|
- name: Install cargo-udeps
|
||||||
|
run: cargo install cargo-udeps --locked
|
||||||
|
|
||||||
|
- name: Check dependencies
|
||||||
|
run: cargo +nightly udeps
|
||||||
|
|
26
Cargo.lock
generated
26
Cargo.lock
generated
@ -99,19 +99,6 @@ dependencies = [
|
|||||||
"os_str_bytes",
|
"os_str_bytes",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clin"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"clap",
|
|
||||||
"env_logger",
|
|
||||||
"handlebars",
|
|
||||||
"http",
|
|
||||||
"log",
|
|
||||||
"reqwest",
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "core-foundation"
|
name = "core-foundation"
|
||||||
version = "0.9.3"
|
version = "0.9.3"
|
||||||
@ -157,6 +144,19 @@ dependencies = [
|
|||||||
"crypto-common",
|
"crypto-common",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dudo"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"clap",
|
||||||
|
"env_logger",
|
||||||
|
"handlebars",
|
||||||
|
"http",
|
||||||
|
"log",
|
||||||
|
"reqwest",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "encoding_rs"
|
name = "encoding_rs"
|
||||||
version = "0.8.31"
|
version = "0.8.31"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "clin"
|
name = "dudo"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
@ -12,4 +12,4 @@ env_logger = "0.10.0"
|
|||||||
log = "0.4.17"
|
log = "0.4.17"
|
||||||
http = "0.2.8"
|
http = "0.2.8"
|
||||||
serde = { version = "1.0.126", features = ["derive"] }
|
serde = { version = "1.0.126", features = ["derive"] }
|
||||||
reqwest = { version = "0.11", features = ["json", "blocking"] }
|
reqwest = { version = "0.11", features = ["json", "blocking"] }
|
||||||
|
@ -6,8 +6,8 @@ RUN cargo build --release
|
|||||||
|
|
||||||
|
|
||||||
FROM alpine:3.17.1
|
FROM alpine:3.17.1
|
||||||
COPY --from=builder /src/target/release/clin /bin/clin
|
COPY --from=builder /src/target/release/dudo /bin/dudo
|
||||||
RUN apk update && apk add --no-cache libressl-dev libc6-compat
|
RUN apk update && apk add --no-cache libressl-dev libc6-compat
|
||||||
RUN chmod +x /bin/clin
|
RUN chmod +x /bin/dudo
|
||||||
WORKDIR /workdir
|
WORKDIR /workdir
|
||||||
ENTRYPOINT ["/bin/clin"]
|
ENTRYPOINT ["/bin/dudo"]
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
# Clever Install (clin)
|
# Dumb Downloader (dudo)
|
||||||
> It's actually not and installer, but a downloader, clin just sounds better than cldow IMHO
|
|
||||||
|
|
||||||
# What's it about?
|
# What's it about?
|
||||||
It's just a tool to make downloading binaries for different platforms easier.
|
It's just a tool to make downloading binaries for different platforms easier.
|
||||||
@ -33,15 +32,15 @@ Prebuilt binaries exist for **Linux x86_64** and **MacOS arm64** and **x86_64**
|
|||||||
|
|
||||||
Don't forget to add the binary to $PATH
|
Don't forget to add the binary to $PATH
|
||||||
```
|
```
|
||||||
$ curl https://raw.githubusercontent.com/allanger/clever-install/main/scripts/download_clin.sh | bash
|
$ curl https://raw.githubusercontent.com/allanger/clever-install/main/scripts/download_dudo.sh | bash
|
||||||
$ clin -h
|
$ dudo -h
|
||||||
```
|
```
|
||||||
### Docker
|
### Docker
|
||||||
|
|
||||||
You can use the `latest` or a `tagged` docker image
|
You can use the `latest` or a `tagged` docker image
|
||||||
```
|
```
|
||||||
$ docker pull ghcr.io/allanger/clever-install:latest
|
$ docker pull ghcr.io/allanger/clever-install:latest
|
||||||
$ docker run ghcr.io/allanger/clever-install:latest clin -h
|
$ docker run ghcr.io/allanger/clever-install:latest dudo -h
|
||||||
```
|
```
|
||||||
|
|
||||||
### Build from source
|
### Build from source
|
||||||
|
@ -36,15 +36,15 @@ esac
|
|||||||
LATEST_VERSION="v$(curl -s https://raw.githubusercontent.com/allanger/clever-install/main/Cargo.toml | awk -F ' = ' '$1 ~ /version/ { gsub(/[\"]/, "", $2); printf("%s",$2); exit}')"
|
LATEST_VERSION="v$(curl -s https://raw.githubusercontent.com/allanger/clever-install/main/Cargo.toml | awk -F ' = ' '$1 ~ /version/ { gsub(/[\"]/, "", $2); printf("%s",$2); exit}')"
|
||||||
echo "Downloading $LATEST_VERSION"
|
echo "Downloading $LATEST_VERSION"
|
||||||
|
|
||||||
RELEASE_NAME=clin-$LATEST_VERSION-$TARGET
|
RELEASE_NAME=dudo-$LATEST_VERSION-$TARGET
|
||||||
RELEASE_URL="https://github.com/allanger/clever-install/releases/download/$LATEST_VERSION/$RELEASE_NAME"
|
RELEASE_URL="https://github.com/allanger/clever-install/releases/download/$LATEST_VERSION/$RELEASE_NAME"
|
||||||
echo "Link for downloading: $RELEASE_URL"
|
echo "Link for downloading: $RELEASE_URL"
|
||||||
curl -LJO $RELEASE_URL
|
curl -LJO $RELEASE_URL
|
||||||
|
|
||||||
mv $RELEASE_NAME clin
|
mv $RELEASE_NAME dudo
|
||||||
chmod +x clin
|
chmod +x dudo
|
||||||
|
|
||||||
echo 'Make sure that clin is in your $PATH'
|
echo 'Make sure that dudo is in your $PATH'
|
||||||
echo 'Try: '
|
echo 'Try: '
|
||||||
echo ' $ export PATH=$PATH:$PWD'
|
echo ' $ export PATH=$PATH:$PWD'
|
||||||
echo ' $ clin -h'
|
echo ' $ dudo -h'
|
@ -1,10 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo 'renaming clin to clin-$VERSION-$SYSTEM format'
|
echo 'renaming dudo to dudo-$VERSION-$SYSTEM format'
|
||||||
mkdir -p release
|
mkdir -p release
|
||||||
echo "version - $CLIN_VERSION"
|
echo "version - $CLIN_VERSION"
|
||||||
for BUILD in build*; do
|
for BUILD in build*; do
|
||||||
SYSTEM=$(echo $BUILD | sed -e 's/build-//g')
|
SYSTEM=$(echo $BUILD | sed -e 's/build-//g')
|
||||||
echo "system - $SYSTEM"
|
echo "system - $SYSTEM"
|
||||||
cp $BUILD/clin release/clin-$CLIN_VERSION-$SYSTEM
|
cp $BUILD/dudo release/dudo-$CLIN_VERSION-$SYSTEM
|
||||||
done
|
done
|
||||||
ls release
|
ls release
|
||||||
|
Loading…
Reference in New Issue
Block a user