Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
36 changes: 36 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Git
.git
.gitignore

# Rust
target/
Cargo.lock

# 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
53 changes: 53 additions & 0 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build and Push OCI Image

on:
push:
branches:
- main
- 'feature/*'
- 'bugfix/*'
tags:
- 'v*.*.*' # Triggers on version tags like v1.0.0

jobs:
prepare:
name: Determine Image Tag
runs-on: ubuntu-latest
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_type }}" == "tag" ]]; then
TAG_NAME="${{ github.ref_name }}"
TAG_NAME="${TAG_NAME#v}" # Remove 'v' prefix using bash parameter expansion
elif [[ "${{ github.ref_name }}" == "main" ]]; then
TAG_NAME="dev-${SHORT_SHA}"
elif [[ "${{ github.ref_name }}" =~ ^feature/ ]] || [[ "${{ github.ref_name }}" =~ ^bugfix/ ]]; then
TAG_NAME="feature-${SHORT_SHA}"
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 }}
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Multi-stage Dockerfile for iExec tee-worker-pre-compute API
# Stage 1: Build stage with Rust toolchain
FROM rust:1.88-alpine3.20 AS builder

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

WORKDIR /app

# Copy Cargo files first for better caching
COPY Cargo.* /app/

# Create a dummy main.rs to build dependencies
RUN mkdir src && \
echo "fn main() {}" > src/main.rs && \
cargo build --release && \
rm -rf src

# Copy source code
COPY src/ /app/src/

# Build the application
RUN cargo build --release --bin tee-worker-pre-compute

# Stage 2: Runtime stage with minimal image
FROM alpine:3.22.1 AS runtime

# Set working directory
WORKDIR /app

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

# Expose port
EXPOSE 3000

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