Skip to content
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

Refactor build #25

Open
wants to merge 142 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
ccf6275
refactor(docker): Simplify Dockerfile and update build process with A…
edenreich Feb 15, 2025
3a50346
ci: Enhance GitHub Actions workflow for building and pushing Docker c…
edenreich Feb 16, 2025
2ddfc74
chore(release): 🔖 0.1.4-rc.1 [skip ci]
edenreich Feb 16, 2025
c0cf8d3
refactor: Update Dockerfile and CI workflow to use clang and llvm for…
edenreich Feb 16, 2025
a41ed31
ci: Make the Build and Push job name shorter
edenreich Feb 16, 2025
c90a1f4
ci: Increase timeout for B&P Containers job to 65 minutes
edenreich Feb 16, 2025
41e2c5f
ci: Update Ubuntu version in release workflow to 24.04 and add arm64 …
edenreich Feb 16, 2025
f610944
ci: Reduce timeout for B&P Containers job from 65 to 15 minutes
edenreich Feb 16, 2025
c0e5b38
chore(release): 🔖 0.1.4-rc.2 [skip ci]
edenreich Feb 16, 2025
274d375
ci: Change ARM64 jobs to use self-hosted runners in release workflow
edenreich Feb 17, 2025
82961f3
chore(release): 🔖 0.1.4-rc.3 [skip ci]
edenreich Feb 17, 2025
d242dce
ci: Update release workflow to handle macOS builds separately
edenreich Feb 17, 2025
74429be
ci: Update release workflow to include ubuntu-22.04-arm64 in self-hos…
edenreich Feb 17, 2025
6e0eeec
chore(release): 🔖 0.1.4-rc.4 [skip ci]
edenreich Feb 17, 2025
8e8af76
ci: Comment out Build and Push Rust Container job in release workflow
edenreich Feb 17, 2025
83461f2
chore(release): 🔖 0.1.4-rc.5 [skip ci]
edenreich Feb 17, 2025
fd20e5b
ci: Split language specific containers with tools to a separate job a…
edenreich Feb 17, 2025
ca6f85f
ci: Remove conditional check for minimal variant in B&P Minimal Conta…
edenreich Feb 17, 2025
1bdf885
ci: Rename build_container job to build_containers and update comment…
edenreich Feb 17, 2025
4a09c1a
ci: Comment out QEMU setup step in release workflow
edenreich Feb 17, 2025
4d00ad3
ci: Comment out temporarily build_binaries job in release workflow to…
edenreich Feb 17, 2025
d6a041f
chore(release): 🔖 0.1.4-rc.6 [skip ci]
edenreich Feb 17, 2025
3422a9f
ci: Add k8s to the list of OS options in release workflow
edenreich Feb 19, 2025
9d308a3
chore(release): 🔖 0.1.4-rc.7 [skip ci]
edenreich Feb 19, 2025
8568c67
ci: Increase timeout for B&P Containers job in release workflow
edenreich Feb 19, 2025
b6c4bf2
chore(release): 🔖 0.1.4-rc.8 [skip ci]
edenreich Feb 19, 2025
8f02226
ci: Update Dockerfile to use rust:alpine as base image and streamline…
edenreich Feb 19, 2025
27486eb
chore(release): 🔖 0.1.4-rc.9 [skip ci]
edenreich Feb 19, 2025
3756ab1
ci: Optimize Dockerfile by removing redundant apk update commands
edenreich Feb 19, 2025
d479ce8
chore(release): 🔖 0.1.4-rc.10 [skip ci]
edenreich Feb 19, 2025
6a2b930
ci: Update release workflow to use Kaniko for building and pushing OC…
edenreich Feb 19, 2025
a01a790
ci: Comment out temporarily the other runner, just to see if it works…
edenreich Feb 19, 2025
2c622ef
chore(release): 🔖 0.1.4-rc.11 [skip ci]
edenreich Feb 19, 2025
af95d59
chore: Resort dev containers dependencies
edenreich Feb 19, 2025
0a9787b
ci: Update release workflow to use Kaniko action for building and pus…
edenreich Feb 19, 2025
fd78e89
chore(release): 🔖 0.1.4-rc.12 [skip ci]
edenreich Feb 19, 2025
68eb13b
chore: Add GitHub Actions extension to devcontainer configuration
edenreich Feb 19, 2025
b236b67
ci: Fix it was targeting the wrong architecture, the option build-arg…
edenreich Feb 19, 2025
aa9b817
chore(release): 🔖 0.1.4-rc.13 [skip ci]
edenreich Feb 19, 2025
0dd8dbf
ci: Fix syntax for build-arg in release workflow
edenreich Feb 19, 2025
aadd3b2
chore(release): 🔖 0.1.4-rc.14 [skip ci]
edenreich Feb 19, 2025
829616f
ci: Update release workflow to use a different action also for kaniko…
edenreich Feb 19, 2025
730b936
chore(release): 🔖 0.1.4-rc.15 [skip ci]
edenreich Feb 19, 2025
1c2415f
chore(cleanup): Cleanup, those labels are redundant because they now …
edenreich Feb 19, 2025
ac38ae3
ci: Test the same job in Kubernetes
edenreich Feb 19, 2025
4c8d93b
chore(release): 🔖 0.1.4-rc.16 [skip ci]
edenreich Feb 19, 2025
20ffe22
ci: Update release workflow to use Ubuntu 24.04 container and adjust …
edenreich Feb 19, 2025
203fe07
chore(release): 🔖 0.1.4-rc.17 [skip ci]
edenreich Feb 19, 2025
5c44837
ci: Small fix - update container syntax in release workflow to use pr…
edenreich Feb 19, 2025
158c14e
chore(release): 🔖 0.1.4-rc.18 [skip ci]
edenreich Feb 19, 2025
1a1ee02
ci: Reduce the reliance on docker
edenreich Feb 19, 2025
f868e16
chore(release): 🔖 0.1.4-rc.19 [skip ci]
edenreich Feb 19, 2025
d10ac77
ci: Update container image in release workflow to use Kaniko executor
edenreich Feb 19, 2025
68e6474
ci: Use directly the container image kaniko and execute the kaniko bi…
edenreich Feb 19, 2025
79bb651
chore(release): 🔖 0.1.4-rc.20 [skip ci]
edenreich Feb 19, 2025
fee3e2d
ci: Update Kaniko executor image to use debug version for troubleshoo…
edenreich Feb 19, 2025
5028cff
ci: Remove explicit verbosity, use default
edenreich Feb 19, 2025
74ad5f8
chore(release): 🔖 0.1.4-rc.21 [skip ci]
edenreich Feb 19, 2025
7e65385
ci: Test something - kaniko suppose to fetch the repo and build
edenreich Feb 19, 2025
af697e0
chore(release): 🔖 0.1.4-rc.22 [skip ci]
edenreich Feb 19, 2025
9739fc2
ci: Simplify Dockerfile path in Kaniko executor configuration - it's …
edenreich Feb 19, 2025
06b4b12
chore(release): 🔖 0.1.4-rc.23 [skip ci]
edenreich Feb 19, 2025
9d50606
ci: Clean up release workflow by removing commented-out steps and sim…
edenreich Feb 19, 2025
c3c5296
ci: Refactor Kaniko build step and Dockerfile for improved environmen…
edenreich Feb 19, 2025
64511c7
chore(release): 🔖 0.1.4-rc.24 [skip ci]
edenreich Feb 19, 2025
420e3e4
ci: Small fix - forgot the $ sign
edenreich Feb 19, 2025
7ed3b5f
chore(release): 🔖 0.1.4-rc.25 [skip ci]
edenreich Feb 19, 2025
30f17d1
ci: Refactor Dockerfile to optimize build process with cargo-chef and…
edenreich Feb 20, 2025
20d85ba
chore: Ensure proper newline at end of Dockerfile for consistency
edenreich Feb 20, 2025
aa5bf99
chore(dockerfile): Format Dockerfile for improved readability and con…
edenreich Feb 20, 2025
206598b
ci: Enable Ubuntu 24.04 with x86_64 target in release workflow
edenreich Feb 20, 2025
ff6cb52
ci: Add metadata fetching step for container build in release workflow
edenreich Feb 20, 2025
ada0abd
ci: Increase timeout for B&P Containers job in release workflow
edenreich Feb 20, 2025
6dc165c
ci: Update Kaniko executor image to v1.23.2 in release workflow, remo…
edenreich Feb 20, 2025
93c1a8c
chore(release): 🔖 0.1.4-rc.26 [skip ci]
edenreich Feb 20, 2025
bab6254
ci: Ok doesn't seems to like it
edenreich Feb 20, 2025
d122f75
chore(release): 🔖 0.1.4-rc.27 [skip ci]
edenreich Feb 20, 2025
7eb50ad
ci: Interesting, so I guess it was the debug tag that I need, it cont…
edenreich Feb 20, 2025
1ad5adf
chore(release): 🔖 0.1.4-rc.28 [skip ci]
edenreich Feb 20, 2025
9ee3a7a
ci: Comment out metadata fetching step in release workflow
edenreich Feb 20, 2025
67d44a7
chore(release): 🔖 0.1.4-rc.29 [skip ci]
edenreich Feb 20, 2025
7a3aeea
ci: Remove metadata fetching step and add image labels manually
edenreich Feb 20, 2025
6dd043f
ci: Remove commented out old workflow
edenreich Feb 20, 2025
13a56b8
chore: update dependencies to latest versions
edenreich Feb 23, 2025
39954db
chore(release): 🔖 0.1.4-rc.30 [skip ci]
edenreich Feb 23, 2025
2878a6d
ci: Update Kaniko executor options for resource allocation and adjust…
edenreich Feb 23, 2025
165ea13
ci: Increase timeout for B&P Containers job to 45 minutes - temporarily
edenreich Feb 23, 2025
6683d00
chore(release): 🔖 0.1.4-rc.31 [skip ci]
edenreich Feb 23, 2025
393aa75
ci: Update cache repository path and TTL in release workflow and redu…
edenreich Feb 23, 2025
44bce8a
chore(release): 🔖 0.1.4-rc.32 [skip ci]
edenreich Feb 23, 2025
9c5a5d0
ci: Update codegen units in Cargo.toml for improved optimization
edenreich Feb 23, 2025
c180c2a
chore(release): 🔖 0.1.4-rc.33 [skip ci]
edenreich Feb 23, 2025
04f3efb
refactor: Ensure caching in a separate layer
edenreich Feb 23, 2025
66748df
chore(release): 🔖 0.1.4-rc.34 [skip ci]
edenreich Feb 24, 2025
8a00250
perf: Add release task for local Docker container execution so I can …
edenreich Feb 24, 2025
dcd030c
build: Increase verbosity of cargo build command in Dockerfile
edenreich Feb 24, 2025
97b7009
chore: Update dependencies to latest versions and optimize release pr…
edenreich Feb 24, 2025
cca01e2
build: Add missing flags, not sure yet why kaniko is not saving into …
edenreich Feb 24, 2025
bceb4b4
build: Update Zsh configuration to include additional right prompt el…
edenreich Feb 25, 2025
fd4f9f4
build: Optimize cargo build command to utilize all available jobs for…
edenreich Feb 25, 2025
59857fd
build: Enhance caching strategy in release workflow and Taskfile with…
edenreich Feb 25, 2025
a19249c
build: Install Dive to better analyse caching layers
edenreich Feb 25, 2025
dd3bc44
build: Remove unnecessary target-specific rustflags for aarch64
edenreich Feb 25, 2025
572d0f9
build: Attempt to fix caching
edenreich Feb 25, 2025
24463ec
build: Import TARGET_ARCH argument to the chef layer in the Dockerfile
edenreich Feb 25, 2025
f05cd51
build: Remove redundant cache cleanup commands from Dockerfile becaus…
edenreich Feb 25, 2025
e447ca3
build: Update Kaniko context to local directory for improved build pr…
edenreich Feb 25, 2025
22d8196
build: Optimize Dockerfile by adding cache mounts for improved build …
edenreich Feb 25, 2025
82d6449
build: Create /app directory in Dockerfile for application workspace
edenreich Feb 26, 2025
f717a40
chore(release): 🔖 0.1.4-rc.35 [skip ci]
edenreich Feb 26, 2025
0fcaca0
build: Add optional shell completions feature using clap_complete
edenreich Feb 26, 2025
5d61147
build: Update uuid dependency to version 1.15.0
edenreich Feb 26, 2025
9782c2e
chore(release): 🔖 0.1.4-rc.36 [skip ci]
edenreich Feb 26, 2025
05ce42a
build: Import CommandFactory for optional completions feature
edenreich Feb 26, 2025
3abdba0
build: Remove unnecessary image creation label from release workflow …
edenreich Feb 26, 2025
72a5c91
build: Simplify Dockerfile by removing cache mounts from cargo commands
edenreich Feb 26, 2025
c78b91c
build: Update release workflow and Taskfile for improved cached conta…
edenreich Feb 26, 2025
a8f6296
build: Add workflow step to sign container images with GitHub OIDC
edenreich Feb 26, 2025
bbee100
build: Increase timeout for B&P Containers job in release workflow
edenreich Feb 26, 2025
f0aa8e8
build: Use consistent style
edenreich Feb 26, 2025
b28e28a
chore(release): 🔖 0.1.4-rc.37 [skip ci]
edenreich Feb 26, 2025
0aa9428
build: Enhance GitHub Actions workflow for container signing and caching
edenreich Feb 26, 2025
7615d06
build: Iterate faster on the release workflow - temporarily
edenreich Feb 27, 2025
15e406e
chore(release): 🔖 0.1.4-rc.38 [skip ci]
edenreich Feb 27, 2025
8698c7f
build: Add Rust toolchain setup and update checkout step in CI workflow
edenreich Feb 27, 2025
3b5cc33
build: Update uuid dependency to version 1.15.1
edenreich Feb 27, 2025
d3068ec
build: Add image pulling step before signing container images in rele…
edenreich Feb 27, 2025
a8d501d
chore(release): 🔖 0.1.4-rc.39 [skip ci]
edenreich Feb 27, 2025
b53889f
build: Uncomment and enable static binary build steps in CI workflow
edenreich Feb 27, 2025
ddb31d6
build: Comment out self-hosted runners for now - I want to make sure …
edenreich Feb 27, 2025
79d3237
build: Update Rust toolchain setup action to version 1.11.0
edenreich Feb 27, 2025
c226efd
build: This is default for the sake of consistency with release workf…
edenreich Feb 27, 2025
3ce07ed
chore(release): 🔖 0.1.4-rc.40 [skip ci]
edenreich Feb 27, 2025
2b8be73
build: Adjust cache key format in release workflow for improved consi…
edenreich Feb 27, 2025
5785306
chore(release): 🔖 0.1.4-rc.41 [skip ci]
edenreich Feb 27, 2025
4583568
build: Attempt to fix cache conflict
edenreich Feb 27, 2025
57a55cc
build: Update cache key format in release workflow for consistency
edenreich Feb 27, 2025
083c2db
chore(release): 🔖 0.1.4-rc.42 [skip ci]
edenreich Feb 27, 2025
8ff0605
build: Ensure using the latest version of the this action
edenreich Feb 27, 2025
a2d2bb2
chore(release): 🔖 0.1.4-rc.43 [skip ci]
edenreich Feb 27, 2025
e55c37f
build: I think I found the issue, those cache entries came from this …
edenreich Feb 27, 2025
591142d
chore(release): 🔖 0.1.4-rc.44 [skip ci]
edenreich Feb 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .cargo/config.toml

This file was deleted.

2 changes: 2 additions & 0 deletions .devcontainer/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export ZSH=$HOME/.oh-my-zsh
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="powerlevel10k/powerlevel10k"

POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status command_execution_time time)

# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME="powerlevel10k/powerlevel10k"
# a theme from this variable instead of looking in $ZSH/themes/
Expand Down
19 changes: 13 additions & 6 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
FROM mcr.microsoft.com/devcontainers/rust:1.0.20-bookworm

ENV ZSH_CUSTOM=/home/vscode/.oh-my-zsh/custom \
TASK_VERSION=v3.41.0
TASK_VERSION=v3.41.0 \
DIVE_VERSION=0.12.0

RUN apt-get update && \
# Install nodejs and npm
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
# Install Task
curl -s https://taskfile.dev/install.sh | sh -s -- -b /usr/local/bin ${TASK_VERSION} && \
apt-get install -y nodejs && \
# Install Task
curl -s https://taskfile.dev/install.sh | sh -s -- -b /usr/local/bin ${TASK_VERSION} && \
# Install Dive
curl -fsSL https://github.com/wagoodman/dive/releases/download/v${DIVE_VERSION}/dive_${DIVE_VERSION}_linux_arm64.tar.gz -o /tmp/dive_${DIVE_VERSION}_linux_arm64.tar.gz && \
tar -xzf /tmp/dive_${DIVE_VERSION}_linux_arm64.tar.gz -C /usr/local/bin && \
chmod +x /usr/local/bin/dive && \
# Cleanup
apt-get clean && \
rm -rf /var/lib/apt/lists/*
rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/*

RUN npm install -g semantic-release @semantic-release/changelog @semantic-release/exec @semantic-release/git @semantic-release/github conventional-changelog-conventionalcommits

Expand All @@ -22,8 +29,8 @@ RUN apt-get update && \
pkg-config \
musl-tools && \
rustup target add \
aarch64-unknown-linux-musl \
x86_64-unknown-linux-musl && \
aarch64-unknown-linux-musl \
x86_64-unknown-linux-musl && \
cd /tmp && \
wget https://musl.cc/aarch64-linux-musl-cross.tgz && \
tar -xzf aarch64-linux-musl-cross.tgz && \
Expand Down
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"vadimcn.vscode-lldb",
"tamasfe.even-better-toml",
"streetsidesoftware.code-spell-checker",
"esbenp.prettier-vscode"
"esbenp.prettier-vscode",
"github.vscode-github-actions"
],
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh",
Expand Down
18 changes: 15 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,31 @@ jobs:
name: Build
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
persist-credentials: false

- name: Install Rust
uses: actions-rust-lang/[email protected]
with:
toolchain: stable
components: rustfmt, clippy
override: true
cache: true
cache-key: ${{ runner.os }}-cargo-ci-${{ hashFiles('**/Cargo.lock') }}

- name: Cache Rust dependencies
uses: actions/cache@v4
uses: actions/cache@v4.2.1
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-cargo-ci-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
${{ runner.os }}-cargo-ci-

- name: Lint
run: cargo fmt --all -- --check
Expand Down
196 changes: 143 additions & 53 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,31 +99,29 @@ jobs:
exit 1
fi

build_artifacts:
name: Build and Upload Artifacts
needs: github_release
build_binaries:
name: Build static binaries
needs:
- github_release
if: needs.github_release.outputs.new_release_published == 'true'
timeout-minutes: 15
permissions:
contents: write
packages: write
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
- os: ubuntu-24.04
target: x86_64-unknown-linux-musl
arch_platform: linux/amd64
timeout: 10
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
arch_platform: linux/arm64
timeout: 40 # Cross-compilation takes longer
# - os:
# - self-hosted
# - k8s
# - ubuntu-22.04-arm64
# target: aarch64-unknown-linux-musl
- os: macos-latest
target: x86_64-apple-darwin
timeout: 10
- os: macos-latest
target: aarch64-apple-darwin
timeout: 10
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
Expand All @@ -142,37 +140,40 @@ jobs:
fi

- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1.10.1
uses: actions-rust-lang/setup-rust-toolchain@v1.11.0
with:
toolchain: stable
override: true
cache: true
cache-key: ${{ runner.os }}-${{ matrix.target }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}

- name: Cache Rust dependencies
uses: actions/cache@v4
uses: actions/cache@v4.2.1
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-${{ matrix.target }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-cargo
${{ runner.os }}-${{ matrix.target }}-cargo-release-

- name: Add target ${{ matrix.target }}
run: rustup target add ${{ matrix.target }}

- name: Add build tools for musl target instead of glibc
if: startsWith(matrix.os, 'ubuntu')
if: ${{ !startsWith(matrix.os, 'macos') }}
run: |
sudo apt-get update && sudo apt-get install --no-install-recommends -y \
curl \
ca-certificates \
build-essential \
clang \
llvm \
pkg-config \
wget \
git \
musl-tools \
libssl-dev \
&& sudo rm -rf /var/lib/apt/lists/* \
Expand All @@ -185,21 +186,25 @@ jobs:
&& rm -rf *.tgz

- name: Build binary for ${{ matrix.target }}
timeout-minutes: ${{ matrix.timeout }}
if: ${{ !startsWith(matrix.os, 'macos') }}
env:
PKG_CONFIG_ALLOW_CROSS: 1
RUSTFLAGS: "-C target-feature=+crt-static"
RUSTFLAGS: "-C target-feature=+crt-static -C linker=clang"
CC: clang
AR: llvm-ar
OPENSSL_DIR: /usr
OPENSSL_LIB_DIR: /usr/lib
OPENSSL_INCLUDE_DIR: /usr/include
OPENSSL_STATIC: 1
CC_aarch64_unknown_linux_musl: aarch64-linux-musl-gcc
AR_aarch64_unknown_linux_musl: aarch64-linux-musl-ar
CC_x86_64_unknown_linux_musl: x86_64-linux-musl-gcc
AR_x86_64_unknown_linux_musl: x86_64-linux-musl-ar
run: |
export PATH="/root/.cargo/bin:/opt/x86_64-linux-musl-cross/bin:/opt/aarch64-linux-musl-cross/bin:${PATH}"
cargo build --release --target ${{ matrix.target }}
cargo build --release --no-default-features --target ${{ matrix.target }}

- name: Build binary for ${{ matrix.target }}
if: ${{ startsWith(matrix.os, 'macos') }}
env:
RUSTFLAGS: "-C target-feature=+crt-static"
run: |
cargo build --release --no-default-features --target ${{ matrix.target }}

- name: Rename binary to the published name
run: |
Expand All @@ -213,37 +218,122 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Set up QEMU
if: startsWith(matrix.os, 'ubuntu')
uses: docker/setup-qemu-action@v3
build_containers:
name: B&P Containers
needs:
- github_release
if: needs.github_release.outputs.new_release_published == 'true'
timeout-minutes: 65
permissions:
packages: write
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
target: x86_64-unknown-linux-musl
# - os:
# - self-hosted
# - k8s
# target: aarch64-unknown-linux-musl
container:
image: gcr.io/kaniko-project/executor:v1.23.2-debug
options: --entrypoint="" --cpu-shares=4096 --memory=6g --cpus=4
runs-on: ${{ matrix.os }}
steps:
- name: Login to GitHub Container Registry
run: |
mkdir -p /kaniko/.docker
cat << EOF > /kaniko/.docker/config.json
{
"auths": {
"ghcr.io": {
"auth": "$(echo -n ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} | base64)"
}
}
}
EOF

- name: Build and push
env:
REPOSITORY_NAME: coder
REPOSITORY_OWNER: ${{ github.repository_owner }}
CONTAINER_REGISTRY: ghcr.io
VERSION: ${{ needs.github_release.outputs.new_release_version }}
run: |
echo "Available cores: $(nproc)"
/kaniko/executor \
--context="${{ github.repositoryUrl }}#${{ github.ref }}" \
--dockerfile=Dockerfile \
--target=minimal \
--destination=${{ env.CONTAINER_REGISTRY }}/${{ env.REPOSITORY_OWNER }}/${{ env.REPOSITORY_NAME }}:latest \
--destination=${{ env.CONTAINER_REGISTRY }}/${{ env.REPOSITORY_OWNER }}/${{ env.REPOSITORY_NAME }}:minimal \
--destination=${{ env.CONTAINER_REGISTRY }}/${{ env.REPOSITORY_OWNER }}/${{ env.REPOSITORY_NAME }}:minimal-${{ env.VERSION }} \
--build-arg=TARGET_ARCH=${{ matrix.target }} \
--label="org.opencontainers.image.version=${{ env.VERSION }}" \
--label="org.opencontainers.image.revision=${{ github.sha }}" \
--label="org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}" \
--label="org.opencontainers.image.url=${{ github.server_url }}/${{ github.repository }}" \
--label="org.opencontainers.image.documentation=${{ github.server_url }}/${{ github.repository }}/blob/main/README.md" \
--label="org.opencontainers.image.title=Coder" \
--label="org.opencontainers.image.description=The AI-Powered Coder without tools" \
--label="org.opencontainers.image.licenses=MIT" \
--label="org.opencontainers.image.vendor=${{ github.repository_owner }}" \
--cache=true \
--cache-repo=${{ env.CONTAINER_REGISTRY }}/${{ env.REPOSITORY_OWNER }}/${{ env.REPOSITORY_NAME }}/cache-${{ matrix.target }} \
--cache-ttl=336h \
--compressed-caching=true \
--snapshot-mode=redo \
--use-new-run \
--ignore-path=".git" \
--skip-unused-stages \

- name: Set up Docker Buildx
if: startsWith(matrix.os, 'ubuntu')
uses: docker/setup-buildx-action@v3
sign_containers:
name: Sign Container Images
needs:
- github_release
- build_containers
if: needs.github_release.outputs.new_release_published == 'true'
runs-on: ubuntu-24.04
permissions:
packages: write
id-token: write # needed for signing the images with GitHub OIDC Token
contents: read
env:
REPOSITORY_NAME: coder
REPOSITORY_OWNER: ${{ github.repository_owner }}
CONTAINER_REGISTRY: ghcr.io
VERSION: ${{ needs.github_release.outputs.new_release_version }}
steps:
- name: Install cosign
uses: sigstore/[email protected]
with:
cosign-release: "v2.4.3"

- name: Login to GitHub Container Registry
if: startsWith(matrix.os, 'ubuntu')
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push container
if: startsWith(matrix.os, 'ubuntu')
uses: docker/build-push-action@v6
with:
context: .
platforms: ${{ matrix.arch_platform }}
push: true
cache-from: type=gha,scope=${{ github.workflow }}-${{ matrix.target }}
cache-to: type=gha,mode=max,scope=${{ github.workflow }}-${{ matrix.target }}
tags: |
ghcr.io/${{ github.repository_owner }}/coder:latest
ghcr.io/${{ github.repository_owner }}/coder:${{ needs.github_release.outputs.new_release_version }}
build-args: |
TARGET_ARCH=${{ matrix.target }}
labels: |
org.opencontainers.image.source=https://github.com/inference-gateway/coder
org.opencontainers.image.description=The AI-Powered Coder
org.opencontainers.image.licenses=MIT
- name: Sign container images with GitHub OIDC
run: |
# Pull the images to sign
docker pull ${CONTAINER_REGISTRY}/${REPOSITORY_OWNER}/${REPOSITORY_NAME}:minimal-${VERSION}
docker pull ${CONTAINER_REGISTRY}/${REPOSITORY_OWNER}/${REPOSITORY_NAME}:latest
docker pull ${CONTAINER_REGISTRY}/${REPOSITORY_OWNER}/${REPOSITORY_NAME}:minimal

# Get digests for the images
VERSION_DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' ${CONTAINER_REGISTRY}/${REPOSITORY_OWNER}/${REPOSITORY_NAME}:minimal-${VERSION})
LATEST_DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' ${CONTAINER_REGISTRY}/${REPOSITORY_OWNER}/${REPOSITORY_NAME}:latest)
MINIMAL_DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' ${CONTAINER_REGISTRY}/${REPOSITORY_OWNER}/${REPOSITORY_NAME}:minimal)

echo "Signing image digest: $VERSION_DIGEST"
echo "Signing image digest: $LATEST_DIGEST"
echo "Signing image digest: $MINIMAL_DIGEST"

# Sign using digests instead of tags
cosign sign --yes $VERSION_DIGEST
cosign sign --yes $LATEST_DIGEST
cosign sign --yes $MINIMAL_DIGEST
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.vscode
.env
.coder
kaniko
Loading