Skip to content

Build docker sample CI #116

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
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
70 changes: 70 additions & 0 deletions .github/workflows/docker_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Weekly build of Sample Docker CI

on:
# 1) Weekly schedule
schedule:
- cron: '0 0 * * 0' # every Sunday at 00:00 UTC

# 2) Trigger when the Dockerfile is changed on main
push:
branches: [ main ]
paths:
- 'sample/Dockerfile'
pull_request:
branches: [ main ]
paths:
- 'sample/Dockerfile'

jobs:
build-and-smoke-test:
runs-on: ubuntu-latest
defaults:
run:
shell: bash

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-

- name: Build crescent-sample image
uses: docker/build-push-action@v4
with:
context: .
file: sample/Dockerfile
load: true
tags: crescent-sample:weekly

- name: Smoke-test extension export
run: |
OUTDIR="${GITHUB_WORKSPACE}/crescent-extension"
rm -rf "$OUTDIR"
mkdir -p "$OUTDIR"

# Directly copy the built extension & mDL into the host volume
docker run --rm \
-v "$OUTDIR:/extension" \
crescent-sample:weekly \
/bin/bash -c "\
cp -r /crescent-credentials/sample/client/dist/* /extension/ && \
cp /crescent-credentials/sample/client/mdl.cbor.hex /extension/ \
"

# Fail if nothing was exported
if [ -z "$(ls -A "$OUTDIR")" ]; then
echo "❌ No extension files found in $OUTDIR"
exit 1
else
echo "✅ Extension export succeeded; files in $OUTDIR:"
ls -1 "$OUTDIR"
fi
4 changes: 2 additions & 2 deletions sample/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#
#
#
# This Dockerfile is used to build a Docker image for the Crescent credentials project and sample.
# You can build and run the sample in the container without installing any dependencies on your local machine
@@ -32,7 +32,7 @@
# # Linux
# docker run -v "$(pwd)/crescent-extension:/extension" -p 8001:8001 -p 8003:8003 -p 8004:8004 crescent-sample
#
#
#

FROM rust:slim

Loading
Oops, something went wrong.