ci: add proper cross compiling!
This commit is contained in:
parent
ee8211a321
commit
643f94b580
2 changed files with 21 additions and 5 deletions
|
@ -3,6 +3,21 @@ when:
|
|||
branch: main
|
||||
|
||||
steps:
|
||||
- name: build-x86_64
|
||||
image: rust:bookworm
|
||||
commands:
|
||||
- cargo build --release
|
||||
- name: build-arm64
|
||||
image: rust:bookworm
|
||||
commands:
|
||||
- dpkg --add-architecture arm64
|
||||
- apt-get update -y && apt-get install -y crossbuild-essential-arm64 libssl-dev:arm64
|
||||
- rustup target add aarch64-unknown-linux-gnu
|
||||
- cargo build --target aarch64-unknown-linux-gnu --release
|
||||
environment:
|
||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
||||
PKG_CONFIG_ALLOW_CROSS: 1
|
||||
PKG_CONFIG_PATH: /usr/aarch64-linux-gnu/lib/pkgconfig
|
||||
- name: container-build-and-publish
|
||||
image: docker
|
||||
commands:
|
||||
|
|
11
Dockerfile
11
Dockerfile
|
@ -1,16 +1,17 @@
|
|||
FROM rust:bookworm AS builder
|
||||
FROM --platform=linux/amd64 debian:12-slim AS prep
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN cargo build --release
|
||||
COPY target/release/backend backend-amd64
|
||||
COPY target/aarch64-unknown-linux-gnu/release/backend backend-arm64
|
||||
|
||||
FROM debian:12-slim
|
||||
|
||||
ARG TARGETARCH
|
||||
|
||||
RUN apt update -y && apt install libssl3 ca-certificates -y && rm -rf /var/lib/apt/lists/* /var/cache/apt/* /tmp/*
|
||||
|
||||
COPY --from=builder /src/target/release/backend /usr/bin/gorb-backend
|
||||
COPY --from=prep /src/backend-${TARGETARCH} /usr/bin/gorb-backend
|
||||
|
||||
COPY entrypoint.sh /usr/bin/entrypoint.sh
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue