-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try to build containers using buildah
- Loading branch information
Showing
3 changed files
with
38 additions
and
56 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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
name: CD | ||
|
||
on: | ||
push: | ||
|
||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
@@ -28,33 +30,44 @@ jobs: | |
- name: install tools | ||
uses: taiki-e/install-action@v2 | ||
with: | ||
tool: [email protected] | ||
tool: [email protected], cross | ||
|
||
- name: Build | ||
run: cargo build --release | ||
- name: Build web | ||
run: trunk build --release web/index.html | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Build amd64 | ||
run: cross build --release --target x86_64-unknown-linux-musl | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
role-to-assume: arn:aws:iam::193543784330:role/oidc-github-ecr-localauth0 | ||
aws-region: us-east-1 | ||
- name: Build aarch64 | ||
run: cross build --release --target aarch64-unknown-linux-musl | ||
|
||
- name: Login to public ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
with: | ||
mask-password: "true" | ||
registry-type: public | ||
#- name: Configure AWS credentials | ||
# uses: aws-actions/configure-aws-credentials@v2 | ||
# with: | ||
# role-to-assume: arn:aws:iam::193543784330:role/oidc-github-ecr-localauth0 | ||
# aws-region: us-east-1 | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
push: true | ||
tags: "public.ecr.aws/c6i9l4r6/localauth0:${{ inputs.tag_name || github.event.release.tag_name }}" | ||
context: . | ||
file: "Dockerfile_localauth0" | ||
#- name: Login to public ECR | ||
# id: login-ecr | ||
# uses: aws-actions/amazon-ecr-login@v1 | ||
# with: | ||
# mask-password: "true" | ||
# registry-type: public | ||
|
||
- name: Create container | ||
run: |- | ||
for arch in amd64 arm64; do | ||
rust_arch="$([ "$arch" = "arm64" ] && echo aarch64 || echo x86_64)-unknown-linux-musl" | ||
ctr="$(buildah from --arch $arch scratch)" | ||
buildah copy "$ctr" "./target/$rust_arch/release/localauth0" "/localauth0" | ||
buildah copy "$ctr" ./web/dist/ /web | ||
buildah config --env 'RUST_LOG error,localauth0=info' --cmd '["/localauth0"]' "$ctr" | ||
buildah commit "$ctr" "localauth0:${{ inputs.tag_name || github.event.release.tag_name }}" | ||
done | ||
#- name: Push | ||
# run: >- | ||
# buildah push --all | ||
# "localauth0:${{ inputs.tag_name || github.event.release.tag_name }}" | ||
# "public.ecr.aws/c6i9l4r6/localauth0:${{ inputs.tag_name || github.event.release.tag_name }}" |
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.