-
Notifications
You must be signed in to change notification settings - Fork 0
ci: build and publish pre-compute OCI image to docker-regis #29
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
Merged
Merged
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 18417cc
fix: refine branch pattern matching in docker-build workflow
nabil-Tounarti e6febbf
fix: improve runtime image and workflow branch handling
nabil-Tounarti 0f076d9
feat: make docker-build workflow depend on CI workflow success
nabil-Tounarti 7190a5a
refactor(docker): remove caching steps from Dockerfile
nabil-Tounarti 2082a1d
chore: remove binary from repository
nabil-Tounarti 06be8bc
refactor(docker): implement multi-stage Dockerfile
nabil-Tounarti d05a28b
docker: simplify Dockerfile and update Alpine version
nabil-Tounarti 25ff757
ci: update workflow to trigger on push and enforce tags on main
nabil-Tounarti fa6bf7c
refactor: add build job to CI workflow and enhance job triggering
nabil-Tounarti c7085c4
fix: update rust version
nabil-Tounarti 7b9625d
Refactor: adjust parameter order in Docker build workflow
nabil-Tounarti 761db12
ci: update workflow name for releases and use ENTRYPOINT in Dockerfile
nabil-Tounarti cf935b3
ci: update workflow triggers to run on push to main and allow workflo…
nabil-Tounarti 1a842e7
ci: add workflow_dispatch trigger and replace ref_name with head_ref
nabil-Tounarti 536da28
chore: pin apk package versions in Dockerfile
nabil-Tounarti de91c58
fix: update apk package versions in Dockerfile
nabil-Tounarti 20cc0da
ci: update workflows to use [email protected] and fix tag check
nabil-Tounarti 591a1ac
ci: improve Docker tag determination for workflow_dispatch events
nabil-Tounarti a8b0f9a
Merge branch 'main' into feature/add-docker-build-workflow
nabil-Tounarti f2f44a7
ci: update docker-build workflow to docker-build-v2.4.0
nabil-Tounarti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Build and Push OCI Image | ||
jbern0rd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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 | ||
Natchica marked this conversation as resolved.
Show resolved
Hide resolved
Natchica marked this conversation as resolved.
Show resolved
Hide resolved
|
||
TAG_BRANCHES=$(git branch -r --contains ${{ github.sha }} | grep -E '(origin/main|origin/master)' || true) | ||
jbern0rd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if [[ -n "$TAG_BRANCHES" ]]; then | ||
jbern0rd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 | ||
jbern0rd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 | ||
Natchica marked this conversation as resolved.
Show resolved
Hide resolved
|
||
secrets: | ||
username: ${{ secrets.NEXUS_USERNAME }} | ||
password: ${{ secrets.NEXUS_PASSWORD }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | ||
jbern0rd marked this conversation as resolved.
Show resolved
Hide resolved
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.