-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7b2c031
commit ef40ae6
Showing
12 changed files
with
131 additions
and
58 deletions.
There are no files selected for viewing
This file contains 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,53 @@ | ||
name: Create and publish glove-build-env image | ||
|
||
#on: workflow_dispatch | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }}/glove-build-env | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
|
||
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. | ||
permissions: | ||
contents: read | ||
packages: write | ||
attestations: write | ||
id-token: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# https://github.com/docker/metadata-action | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: type=sha,format=long | ||
|
||
# https://github.com/docker/build-push-action | ||
- name: Build and push image | ||
id: push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: glove-build-env | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 was deleted.
Oops, something went wrong.
This file contains 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,24 @@ | ||
#!/bin/bash | ||
|
||
set -Eeuxo pipefail | ||
|
||
glove_build_env() { | ||
docker exec -t glove-build-env "$@" | ||
} | ||
|
||
rm -rf target | ||
mkdir -p target/release | ||
# TODO use pinned digest of glove-build-env image | ||
docker create --name glove-build-env -v /var/run/docker.sock:/var/run/docker.sock -w /glove glove-build-env | ||
docker cp . glove-build-env:/glove | ||
docker start glove-build-env > /dev/null | ||
glove_build_env git config --global --add safe.directory /glove | ||
glove_build_env cargo test | ||
glove_build_env cargo build --bins -p enclave --target x86_64-unknown-linux-musl -r | ||
glove_build_env cargo build --bins --workspace --exclude enclave -r | ||
glove_build_env touch --date='@0' target/x86_64-unknown-linux-musl/release/enclave | ||
glove_build_env docker build --no-cache -t glove-enclave -f enclave/Dockerfile . | ||
glove_build_env nitro-cli build-enclave --docker-uri glove-enclave --output-file target/release/glove.eif | ||
docker cp glove-build-env:/glove/target . | ||
docker image rm glove-enclave > /dev/null | ||
docker rm -f glove-build-env > /dev/null |
This file contains 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 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 |
---|---|---|
@@ -1,7 +1,4 @@ | ||
# TODO Use alpine instead, which will reduce the size of the image and potentially only require 512MB of enclave memory. | ||
# However, this requires building the enclave with musl, which has been a bit tricky to get working on Amazon Linux 2023. | ||
FROM debian:stable-20240612-slim | ||
# TODO If we can't get alphine working then manually install libssl3 from a specific version to keep the build reproducible. | ||
RUN apt-get update && apt-get install libssl3 -y | ||
COPY ../target/release/enclave . | ||
# For reproducible builds, pin the linux distro to an exact digest, here representing v3.20.1 | ||
FROM --platform=linux/amd64 alpine@sha256:dabf91b69c191a1a0a1628fd6bdd029c0c4018041c7f052870bb13c5a222ae76 | ||
COPY ../target/x86_64-unknown-linux-musl/release/enclave . | ||
CMD ["./enclave"] |
This file contains 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 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,15 @@ | ||
FROM --platform=linux/amd64 amazonlinux:2023 | ||
|
||
ENV PATH="/root/.cargo/bin:$PATH" | ||
ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=x86_64-amazon-linux-gcc | ||
|
||
RUN yum update -y | ||
RUN dnf install aws-nitro-enclaves-cli -y | ||
RUN dnf install aws-nitro-enclaves-cli-devel -y | ||
RUN yum groupinstall "Development Tools" -y | ||
RUN yum install openssl-devel -y | ||
RUN dnf install perl -y | ||
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y | ||
RUN rustup target install x86_64-unknown-linux-musl | ||
|
||
CMD ["sleep", "infinity"] |
This file contains 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 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