Skip to content

Commit

Permalink
feat: go back to cross because buildx is insanely slow
Browse files Browse the repository at this point in the history
  • Loading branch information
lennoxlotl committed Oct 21, 2024
1 parent 9c06d6d commit aa8f41a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install cross
run: cargo install cross
- name: Build binary (aarch64)
if: matrix.platform == 'linux/arm64'
run: cross build --target aarch64-unknown-linux-gnu --release
- name: Copy binary (aarch64)
if: matrix.platform == 'linux/arm64'
run: mv target/aarch64-unknown-linux-gnu/release/api api/api
- name: Build binary (amd64)
if: matrix.platform == 'linux/amd64'
run: cargo build --release
- name: Copy binary (amd64)
if: matrix.platform == 'linux/amd64'
run: mv target/release/api api/api
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
Expand All @@ -46,6 +60,7 @@ jobs:
with:
push: true
platforms: ${{ matrix.platform }}
context: api/
file: api/Dockerfile
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
Expand Down
11 changes: 1 addition & 10 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
# Build the binary file
FROM rust:1.82.0-bullseye AS builder

WORKDIR /api
COPY . .

RUN cargo build --release

# Run the binary file
FROM debian:bullseye-slim

WORKDIR /api
COPY --from=builder /api/target/release/api ./api
COPY ./api .

RUN apt update && apt install -y ca-certificates

Expand Down

0 comments on commit aa8f41a

Please sign in to comment.