Skip to content

Commit

Permalink
Try to build containers using buildah
Browse files Browse the repository at this point in the history
  • Loading branch information
MaeIsBad committed Oct 26, 2023
1 parent 67c04fb commit 9a6c29b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 56 deletions.
59 changes: 36 additions & 23 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: CD

on:
push:

release:
types: [published]
workflow_dispatch:
Expand Down Expand Up @@ -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 }}"
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ serde_json = "1.0.80"

base64 = "0.13.0"
base64-url = "1.4.13"
openssl = "0.10.55"
openssl = { version = "0.10.55", features = ["vendored"]}

chrono = {version = "0.4.19", features = ["serde"]}

Expand All @@ -36,4 +36,4 @@ toml = "0.5.9"

prima_rs_logger = "0.1"

futures = "0.3.21"
futures = "0.3.21"
31 changes: 0 additions & 31 deletions Dockerfile_localauth0

This file was deleted.

0 comments on commit 9a6c29b

Please sign in to comment.