Skip to content

Instantly share code, notes, and snippets.

@ripxorip
Last active June 26, 2021 18:18
Show Gist options
  • Save ripxorip/67d2bc478c8a88012f2128dbebc01a9e to your computer and use it in GitHub Desktop.
Save ripxorip/67d2bc478c8a88012f2128dbebc01a9e to your computer and use it in GitHub Desktop.
Rust cross compile debian docker image
(db rust_cross_compiler /home/ripxorip/.cargo/bin/cargo build --target=aarch64-unknown-linux-gnu)
FROM debian:buster
ARG USERNAME=ripxorip
ARG USER_UID=1000
ARG USER_GID=$USER_UID
RUN groupadd --gid 1000 $USERNAME
RUN useradd -s /bin/bash --uid 1000 --gid 1000 -m $USERNAME
RUN apt-get update -y && apt-get upgrade -y
RUN apt-get install -y sudo
RUN echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
USER ${USERNAME}
RUN sudo apt-get install -y build-essential
RUN sudo apt-get install -y curl
RUN curl https://sh.rustup.rs -sSf | sh /dev/stdin -y && \
PATH=$PATH:$HOME/.cargo/bin && \
rustup target add aarch64-unknown-linux-gnu
RUN sudo apt-get install -y gcc-aarch64-linux-gnu libc-dev-arm64-cross
RUN sudo dpkg --add-architecture arm64
RUN sudo apt-get update -y && sudo apt-get upgrade -y
RUN sudo apt-get install -y libgtk-3-dev:arm64
ENV PKG_CONFIG_ALLOW_CROSS=1
ENV PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment