peterhuene / azure-functions-rs

Create Azure Functions with Rust!
https://functions.rs
MIT License
127 stars 25 forks source link

Docker fails to build - cannot compile jemalloc #543

Open pyrohaz4good opened 4 years ago

pyrohaz4good commented 4 years ago

When following the readme instructions using MacOS and Ubuntu 18.04, building the docker file fails with

#15 24.64 ===============================================================================
#15 24.64 running: "make" "srcroot=../jemalloc/" "-j" "4"
#15 24.64 
#15 24.64 --- stderr
#15 24.64 thread 'main' panicked at 'failed to execute command: No such file or directory (os error 2)', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/jemalloc-sys-0.3.2/build.rs:389:19
#15 24.64 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
#15 24.64 
#15 24.64 warning: build failed, waiting for other jobs to finish...
#15 28.51 error: build failed
------
failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = failed to build LLB: executor failed running [cargo run --release -- init --script-root /home/site/wwwroot --sync-extensions]: runc did not terminate sucessfully

Docker version:

Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b7f0
 Built:             Wed Mar 11 01:25:46 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       afacb8b7f0
  Built:            Wed Mar 11 01:24:19 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Steps to repro:

  1. cargo func new-app repro
  2. cd repro
  3. cargo func new http -n foo --auth-level anonymous
  4. export DOCKER_BUILDKIT=1
  5. docker build .
pyrohaz4good commented 4 years ago

I solved this by changing the docker file to use:

FROM rust:latest AS build-image

I then add the dotnet SDK to the image:

RUN wget https://download.visualstudio.microsoft.com/download/pr/022d9abf-35f0-4fd5-8d1c-86056df76e89/477f1ebb70f314054129a9f51e9ec8ec/dotnet-sdk-2.2.207-linux-x64.tar.gz
RUN gunzip -d dotnet-sdk-2.2.207-linux-x64.tar.gz
RUN tar xvf dotnet-sdk-2.2.207-linux-x64.tar -C /usr/bin

I have no idea if that's really the right way to do this, but its my hack it all together way.