content: ARG GO_VERSION=1.22
  ARG RUST_VERSION=nightly-2023-12-03
  ARG CARGO_CHEF_TAG=0.1.41
  
  FROM golang:${GO_VERSION}-alpine
  
  RUN apk add --no-cache gcc musl-dev linux-headers git ca-certificates openssl-dev
  
  # RUN apk add --no-cache libc6-compat
  # RUN apk add --no-cache gcompat
  
  ENV RUSTUP_HOME=/usr/local/rustup \
      CARGO_HOME=/usr/local/cargo \
      PATH=/usr/local/cargo/bin:$PATH \
      CARGO_NET_GIT_FETCH_WITH_CLI=true
  
  RUN set -eux; \
      apkArch="$(apk --print-arch)"; \
      case "$apkArch" in \
          x86_64) rustArch='x86_64-unknown-linux-musl' ;; \
          aarch64) rustArch='aarch64-unknown-linux-musl' ;; \
          *) echo >&2 "unsupported architecture: $apkArch"; exit 1 ;; \
      esac; \
      \
      url="https://static.rust-lang.org/rustup/dist/${rustArch}/rustup-init"; \
      wget "$url"; \
      chmod +x rustup-init;
  
  ARG RUST_VERSION
  RUN ./rustup-init -y --no-modify-path --default-toolchain ${RUST_VERSION}; \
      rm rustup-init; \
      chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
      rustup --version; \
      cargo --version; \
      rustc --version;
  
  ARG CARGO_CHEF_TAG
  RUN cargo install cargo-chef --locked --version ${CARGO_CHEF_TAG} \
      && rm -rf $CARGO_HOME/registry/
  