Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c76777c
ci: build and publish pre-compute OCI image to docker-regis
nabil-Tounarti Aug 13, 2025
18417cc
fix: refine branch pattern matching in docker-build workflow
nabil-Tounarti Aug 18, 2025
e6febbf
fix: improve runtime image and workflow branch handling
nabil-Tounarti Aug 18, 2025
0f076d9
feat: make docker-build workflow depend on CI workflow success
nabil-Tounarti Aug 18, 2025
7190a5a
refactor(docker): remove caching steps from Dockerfile
nabil-Tounarti Aug 18, 2025
2082a1d
chore: remove binary from repository
nabil-Tounarti Aug 18, 2025
06be8bc
refactor(docker): implement multi-stage Dockerfile
nabil-Tounarti Aug 18, 2025
d05a28b
docker: simplify Dockerfile and update Alpine version
nabil-Tounarti Aug 18, 2025
25ff757
ci: update workflow to trigger on push and enforce tags on main
nabil-Tounarti Aug 19, 2025
fa6bf7c
refactor: add build job to CI workflow and enhance job triggering
nabil-Tounarti Aug 20, 2025
c7085c4
fix: update rust version
nabil-Tounarti Aug 20, 2025
7b9625d
Refactor: adjust parameter order in Docker build workflow
nabil-Tounarti Aug 21, 2025
761db12
ci: update workflow name for releases and use ENTRYPOINT in Dockerfile
nabil-Tounarti Aug 25, 2025
cf935b3
ci: update workflow triggers to run on push to main and allow workflo…
nabil-Tounarti Aug 26, 2025
1a842e7
ci: add workflow_dispatch trigger and replace ref_name with head_ref
nabil-Tounarti Aug 26, 2025
536da28
chore: pin apk package versions in Dockerfile
nabil-Tounarti Aug 26, 2025
de91c58
fix: update apk package versions in Dockerfile
nabil-Tounarti Aug 26, 2025
20cc0da
ci: update workflows to use [email protected] and fix tag check
nabil-Tounarti Aug 26, 2025
591a1ac
ci: improve Docker tag determination for workflow_dispatch events
nabil-Tounarti Aug 28, 2025
a8b0f9a
Merge branch 'main' into feature/add-docker-build-workflow
nabil-Tounarti Aug 28, 2025
f2f44a7
ci: update docker-build workflow to docker-build-v2.4.0
nabil-Tounarti Aug 28, 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
35 changes: 35 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Git
.git
.gitignore

# Rust
target/

# IDE
.vscode/
.idea/
*.swp
*.swo

# OS
.DS_Store
Thumbs.db

# Logs
*.log

# Documentation
README.md
docs/

# Docker
Dockerfile
.dockerignore

# CI/CD
.github/

# Tests
tests/
**/*_test.rs
**/*_tests.rs
45 changes: 45 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Rust CI

on:
pull_request:
types: [opened]
push:

jobs:
Expand All @@ -12,3 +13,47 @@ jobs:
working-directory: "."
enable-cache: true
publish-crates-io: false

prepare:
name: Determine Image Tag
runs-on: ubuntu-latest
needs: build-and-test
if: github.ref_name == 'main' || startsWith(github.ref_name, 'feature/') || startsWith(github.ref_name, 'bugfix/')
outputs:
tag: ${{ steps.determine-tag.outputs.tag }}
steps:
- name: Determine Docker tag based on Git ref
id: determine-tag
run: |
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-8)

if [[ "${{ github.ref_name }}" == "main" ]]; then
TAG_NAME="dev-${SHORT_SHA}"
echo "Processing main branch push -> ${TAG_NAME}"
else
# This covers feature/ and bugfix/ branches
TAG_NAME="feature-${SHORT_SHA}"
echo "Processing feature/bugfix branch: ${{ github.ref_name }} -> ${TAG_NAME}"
fi

echo "tag=${TAG_NAME}" >> "$GITHUB_OUTPUT"
echo "Determined image tag: ${TAG_NAME}"

build-and-publish:
name: Build and Publish to Registry
needs: prepare
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/docker-build.yml@main
with:
image-name: docker-regis.iex.ec/tee-worker-pre-compute-rust
image-tag: ${{ needs.prepare.outputs.tag }}
dockerfile: Dockerfile
context: .
platforms: linux/amd64
registry: docker-regis.iex.ec
push: true
security-scan: true
security-report: "sarif"
hadolint: true
secrets:
username: ${{ secrets.NEXUS_USERNAME }}
password: ${{ secrets.NEXUS_PASSWORD }}
56 changes: 56 additions & 0 deletions .github/workflows/docker-build-on-tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build and Push OCI Image

on:
push:
tags:
- 'v*.*.*'

jobs:
prepare:
name: Determine Image Tag
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.determine-tag.outputs.tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Determine Docker tag based on Git ref
id: determine-tag
run: |
# Since this workflow only triggers on tags matching 'v*.*.*' we know we're always dealing with a version tag, we know we're always dealing with a version tag
TAG_BRANCHES=$(git branch -r --contains ${{ github.sha }} | grep -E '(origin/main|origin/master)' || true)

if [[ -n "$TAG_BRANCHES" ]]; then
TAG_NAME="${{ github.ref_name }}"
TAG_NAME="${TAG_NAME#v}" # Remove 'v' prefix
echo "Processing tag on main branch: ${{ github.ref_name }} -> ${TAG_NAME}"
else
echo "Error: Tag ${{ github.ref_name }} is not on main branch"
echo "Tags must be created on main branch to generate X.Y.Z image tags"
exit 1
fi

echo "tag=${TAG_NAME}" >> "$GITHUB_OUTPUT"
echo "Determined image tag: ${TAG_NAME}"

build-and-publish:
name: Build and Publish to Registry On Tag
needs: prepare
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/docker-build.yml@main
with:
image-name: docker-regis.iex.ec/tee-worker-pre-compute-rust
image-tag: ${{ needs.prepare.outputs.tag }}
dockerfile: Dockerfile
context: .
platforms: linux/amd64
registry: docker-regis.iex.ec
push: true
security-scan: true
security-report: "sarif"
hadolint: true
secrets:
username: ${{ secrets.NEXUS_USERNAME }}
password: ${{ secrets.NEXUS_PASSWORD }}
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM rust:1.88-alpine3.22 AS builder

# Install build dependencies
RUN apk add --no-cache musl-dev openssl-dev

WORKDIR /app

# Copy manifest and source files
COPY . .

# Build the application
RUN cargo build --release

FROM alpine:3.22

# Install required runtime dependencies
RUN apk add --no-cache libgcc

# Set working directory
WORKDIR /app

# Copy the binary from builder stage
COPY --from=builder /app/target/release/tee-worker-pre-compute .

# Run the application
CMD ["/app/tee-worker-pre-compute"]