Skip to content

Instantly share code, notes, and snippets.

@miigotu
Last active March 26, 2021 01:22
Show Gist options
  • Save miigotu/2a0b80677420d806c96d8e792ae6652e to your computer and use it in GitHub Desktop.
Save miigotu/2a0b80677420d806c96d8e792ae6652e to your computer and use it in GitHub Desktop.
# Dockerfile
FROM python:3.7-slim-buster
RUN apt-get update -q && apt-get install -yq build-essential libssl-dev libffi-dev python3-dev curl
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -sx -- -y
RUN echo 'fn main() {println!("Hello World!");}' > hello.rs && $HOME/.cargo/bin/rustc hello.rs && ./hello
CMD ./hello
# Try to build for these 2 architectures
docker buildx build -t hello --platform linux/arm/v6 -f Dockerfile .
docker buildx build -t hello --platform linux/386 -f Dockerfile .
# i386
# Downloads x86_64_unknown_gnu
 > [4/4] RUN echo 'fn main() {println!("Hello World!");}' > hello.rs && $HOME/.cargo/bin/rustc hello.rs && ./hello:                                                                                                                       
#7 0.900 error: command failed: 'rustc'                                                                                                                                                                                                   
#7 0.900 error: caused by: No such file or directory (os error 2)
# ARMv6
97% ❯ docker buildx build -t hello --platform linux/arm/v6 -f d .
[+] Building 7.3s (6/7)                                                                                                                                                                                                                   
=> [internal] load build definition from d                                                                                                                                                                                          0.0s
=> => transferring dockerfile: 405B                                                                                                                                                                                                 0.0s
=> [internal] load .dockerignore                                                                                                                                                                                                    0.0s
=> => transferring context: 34B                                                                                                                                                                                                     0.0s
=> [internal] load metadata for docker.io/library/python:3.7-slim-buster                                                                                                                                                            0.5s
=> [1/4] FROM docker.io/library/python:3.7-slim-buster@sha256:cc3bf04743e786273ccc77d2042404eba1292ebf54787688402b7f349dae242f                                                                                                      0.0s
=> CACHED [2/4] RUN apt-get update -q && apt-get install -yq build-essential libssl-dev libffi-dev python3-dev curl                                                                                                                 0.0s
=> ERROR [3/4] RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -sx -- -y                                                                                                                                         6.7s
------                                                                                                                                                                                                                                    
> [3/4] RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -sx -- -y:                                                                                                                                                    
#6 0.780 + [  = Version JM 93t+ 2010-03-05 ]                                                                                                                                                                                              
#6 0.781 + set -u                                                                                                                                                                                                                         
#6 0.782 + RUSTUP_UPDATE_ROOT=https://static.rust-lang.org/rustup                                                                                                                                                                         
#6 0.789 + main -y                                                                                                                                                                                                                        
#6 0.789 + downloader --check
#6 0.789 + local _dld
#6 0.789 + local _ciphersuites
#6 0.789 + local _err
#6 0.789 + local _status
#6 0.789 + check_cmd curl
#6 0.790 + command -v curl
#6 0.791 + _dld=curl
#6 0.791 + [ --check = --check ]
#6 0.791 + need_cmd curl
#6 0.791 + check_cmd curl
#6 0.791 + command -v curl
#6 0.792 + need_cmd uname
#6 0.792 + check_cmd uname
#6 0.792 + command -v uname
#6 0.792 + need_cmd mktemp
#6 0.792 + check_cmd mktemp
#6 0.792 + command -v mktemp
#6 0.792 + need_cmd chmod
#6 0.792 + check_cmd chmod
#6 0.792 + command -v chmod
#6 0.792 + need_cmd mkdir
#6 0.792 + check_cmd mkdir
#6 0.792 + command -v mkdir
#6 0.793 + need_cmd rm
#6 0.793 + check_cmd rm
#6 0.793 + command -v rm
#6 0.793 + need_cmd rmdir
#6 0.793 + check_cmd rmdir
#6 0.793 + command -v rmdir
#6 0.793 + get_architecture
#6 0.793 + local _ostype _cputype _bitness _arch _clibtype
#6 0.794 + uname -s
#6 0.817 + _ostype=Linux
#6 0.818 + uname -m
#6 0.840 + _cputype=armv7l
#6 0.840 + _clibtype=gnu
#6 0.840 + [ Linux = Linux ]
#6 0.841 + uname -o
#6 0.863 + [ GNU/Linux = Android ]
#6 0.864 + ldd --version
#6 0.864 + grep -q musl
#6 0.949 + [ Linux = Darwin ]
#6 0.949 + [ Linux = SunOS ]
#6 0.950 + _ostype=unknown-linux-gnu
#6 0.951 + get_bitness
#6 0.951 + need_cmd head
#6 0.951 + check_cmd head
#6 0.951 + command -v head
#6 0.951 + local _current_exe_head
#6 0.951 + head -c 5 /proc/self/exe
#6 0.977 /usr/bin/head: error reading '/proc/self/exe': Bad file descriptor
#6 0.977 /usr/bin/head: failed to close '/proc/self/exe': Bad file descriptor
#6 0.980 + _current_exe_head=
#6 0.980 + printf \177ELF\001
#6 0.981 + [  = �ELF ]
#6 0.982 + printf \177ELF\002
#6 0.983 + [  = �ELF ]
#6 0.983 + err unknown platform bitness
#6 0.983 + say unknown platform bitness
#6 0.983 + printf rustup: %s\n unknown platform bitness
#6 0.984 rustup: unknown platform bitness
#6 0.984 + exit 1
#6 0.984 + _bitness=
#6 0.984 + _cputype=armv7
#6 0.985 + [ unknown-linux-gnu = linux-android ]
#6 0.985 + _ostype=unknown-linux-gnueabihf
#6 0.985 + [ unknown-linux-gnueabihf = unknown-linux-gnu ]
#6 0.985 + [ unknown-linux-gnueabihf = unknown-linux-gnueabihf ]
#6 0.985 + [ armv7 = armv7 ]
#6 0.986 + ensure grep+  ^Features /proc/cpuinfogrep
#6 0.986  -q -v neon
#6 0.986 + grep ^Features /proc/cpuinfo
#6 1.023 + err command failed: grep ^Features /proc/cpuinfo
#6 1.023 + say command failed: grep ^Features /proc/cpuinfo
#6 1.023 + printf rustup: %s\n command failed: grep ^Features /proc/cpuinfo
#6 1.023 rustup: command failed: grep ^Features /proc/cpuinfo
#6 1.023 + exit 1
#6 1.026 + _arch=armv7-unknown-linux-gnueabihf
#6 1.026 + RETVAL=armv7-unknown-linux-gnueabihf
#6 1.026 + local _arch=armv7-unknown-linux-gnueabihf
#6 1.026 + assert_nz armv7-unknown-linux-gnueabihf arch
#6 1.027 + [ -z armv7-unknown-linux-gnueabihf ]
#6 1.027 + local _ext=
#6 1.027 + local _url=https://static.rust-lang.org/rustup/dist/armv7-unknown-linux-gnueabihf/rustup-init
#6 1.027 + local _dir
#6 1.028 + mktemp -d
#6 1.054 + _dir=/tmp/tmp.9ybrYjgn2i
#6 1.054 + local _file=/tmp/tmp.9ybrYjgn2i/rustup-init
#6 1.054 + local _ansi_escapes_are_valid=false
#6 1.054 + [ -t 2 ]
#6 1.055 + local need_tty=yes
#6 1.055 + need_tty=no
#6 1.055 + false
#6 1.055 + printf %s\n info: downloading installer
#6 1.055 info: downloading installer
#6 1.055 + ensure mkdir -p /tmp/tmp.9ybrYjgn2i
#6 1.056 + mkdir -p /tmp/tmp.9ybrYjgn2i
#6 1.084 + ensure downloader https://static.rust-lang.org/rustup/dist/armv7-unknown-linux-gnueabihf/rustup-init /tmp/tmp.9ybrYjgn2i/rustup-init armv7-unknown-linux-gnueabihf
#6 1.084 + downloader https://static.rust-lang.org/rustup/dist/armv7-unknown-linux-gnueabihf/rustup-init /tmp/tmp.9ybrYjgn2i/rustup-init armv7-unknown-linux-gnueabihf
#6 1.084 + local _dld
#6 1.084 + local _ciphersuites
#6 1.084 + local _err
#6 1.084 + local _status
#6 1.084 + check_cmd curl
#6 1.085 + command -v curl
#6 1.085 + _dld=curl
#6 1.085 + [ https://static.rust-lang.org/rustup/dist/armv7-unknown-linux-gnueabihf/rustup-init = --check ]
#6 1.085 + [ curl = curl ]
#6 1.085 + get_ciphersuites_for_curl
#6 1.085 + [ -n  ]
#6 1.085 + local _openssl_syntax=no
#6 1.085 + local _gnutls_syntax=no
#6 1.085 + local _backend_supported=yes
#6 1.086 + curl -V
#6 1.086 + grep -q  OpenSSL/
#6 1.161 + _openssl_syntax=yes
#6 1.161 + local _args_supported=no
#6 1.161 + [ yes = yes ]
#6 1.162 + check_help_for notspecified curl --tlsv1.2 --ciphers --proto
#6 1.162 + local _arch
#6 1.162 + local _cmd
#6 1.162 + local _arg
#6 1.162 + _arch=notspecified
#6 1.162 + shift
#6 1.162 + _cmd=curl
#6 1.162 + shift
#6 1.163 + curl --help
#6 1.163 + grep -q -- --tlsv1.2
#6 1.237 + curl --help
#6 1.237 + grep -q -- --ciphers
#6 1.314 + curl --help
#6 1.314 + grep -q -- --proto
#6 1.395 + true
#6 1.395 + _args_supported=yes
#6 1.395 + local _cs=
#6 1.395 + [ yes = yes ]
#6 1.395 + [ yes = yes ]
#6 1.396 + get_strong_ciphersuites_for openssl
#6 1.396 + [ openssl = openssl ]
#6 1.396 + echo TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384
#6 1.397 + _cs=TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384
#6 1.397 + RETVAL=TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384
#6 1.397 + _ciphersuites=TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384
#6 1.397 + [ -n TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384 ]
#6 1.398 + curl --proto =https --tlsv1.2 --ciphers TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384 --silent --show-error --fail --location https://static.rust-lang.org/rustup/dist/armv7-unknown-linux-gnueabihf/rustup-init --output /tmp/tmp.9ybrYjgn2i/rustup-init
#6 6.624 + _err=
#6 6.625 + _status=0
#6 6.625 + [ -n  ]
#6 6.625 + return 0
#6 6.625 + ensure chmod u+x /tmp/tmp.9ybrYjgn2i/rustup-init
#6 6.625 + chmod u+x /tmp/tmp.9ybrYjgn2i/rustup-init
#6 6.653 + [ ! -x /tmp/tmp.9ybrYjgn2i/rustup-init ]
#6 6.653 + [ no = yes ]
#6 6.653 + ignore /tmp/tmp.9ybrYjgn2i/rustup-init -y
#6 6.653 + /tmp/tmp.9ybrYjgn2i/rustup-init -y
#6 6.657 /lib/ld-linux-armhf.so.3: No such file or directory
#6 6.658 + local _retval=255
#6 6.658 + ignore rm /tmp/tmp.9ybrYjgn2i/rustup-init
#6 6.658 + rm /tmp/tmp.9ybrYjgn2i/rustup-init
#6 6.683 + ignore rmdir /tmp/tmp.9ybrYjgn2i
#6 6.683 + rmdir /tmp/tmp.9ybrYjgn2i
#6 6.706 + return 255
#6 6.707 + exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment