Skip to content

Try to build containers using buildah #22

Try to build containers using buildah

Try to build containers using buildah #22

Workflow file for this run

name: CD
on:
push:
release:
types: [published]
workflow_dispatch:
inputs:
tag_name:
description: "The tag name to use"
required: true
type: string
env:
CARGO_TERM_COLOR: always
jobs:
release:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- run: rustup target add wasm32-unknown-unknown
- name: install tools
uses: taiki-e/install-action@v2
with:
tool: [email protected], cross
- name: Build web
run: trunk build --release web/index.html
- name: Build amd64
run: cross build --release --target x86_64-unknown-linux-musl
- name: Build aarch64
run: cross build --release --target aarch64-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: 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 }}"