I’m working on some abstractions to make it easier for a developer to start working on ICP smart contracts and as part of that I created this docker image.
I wanted to share if anyone has been looking for it:
https://hub.docker.com/r/cryptoisgood/wdfx
Share any issues you find please
5 Likes
Hey, would be great if you could also provide a link to the repo with the Dockerfile.
Thanks!
I tried to implement a Dockerfile using this as a reference (I didn’t could use this one because it has old dependencies), but when I run “dfx deploy” I have next error:
2023-11-05T06:05:59.750744Z ERROR icx_proxy_dev::proxy: Internal Error during request:
error trying to connect: tcp connect error: Cannot assign requested address (os error 99)
2023-11-05T06:05:59.755699Z ERROR tower_http::trace::on_failure: response failed classification=Status code: 500 Internal Server Error latency=21 ms
Mi Dockerfile is:
FROM --platform=linux/amd64 ubuntu:22.04
# replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# Prepare workdir
WORKDIR /root/dfx
# Update the apt package list and install the required packages
RUN apt -yq update && \
apt -yqq install --no-install-recommends curl ca-certificates \
build-essential pkg-config libssl-dev llvm-dev liblmdb-dev clang cmake rsync \
libunwind8
# Clean apt
RUN apt autoremove && apt clean
# Install Node
ENV NVM_VERSION=v0.39.5
RUN curl --fail -sSf https://raw.githubusercontent.com/creationix/nvm/${NVM_VERSION}/install.sh | bash
ENV NVM_DIR=/root/.nvm
ENV NODE_VERSION=18
RUN . "${NVM_DIR}/nvm.sh" && nvm install ${NODE_VERSION}
RUN . "${NVM_DIR}/nvm.sh" && nvm use v${NODE_VERSION}
RUN . "${NVM_DIR}/nvm.sh" && nvm alias default v${NODE_VERSION}
ENV PATH="/root/.nvm/versions/node/default/bin/:${PATH}"
# Install Rust and Cargo
ENV RUSTUP_HOME=/opt/rustup \
CARGO_HOME=/cargo \
PATH=/cargo/bin:$PATH
COPY ./scripts ./scripts
COPY ./rust-toolchain.toml ./rust-toolchain.toml
RUN sh ./scripts/rust-bootstrap
# Install IC SDK
ENV DFX_VERSION=0.15.1
RUN sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)"
SHELL ["/bin/bash", "-c"]
CMD tail -f /dev/null
rust-toolchain.toml
[toolchain]
channel = "1.73.0"
targets = ["wasm32-unknown-unknown"]
rust-bootstrap
#!/usr/bin/env bash
# install build dependencies (rustup + ic-wasm)
set -euo pipefail
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPTS_DIR/.."
function run() {
1>&2 echo "running $@"
rc=0 && "$@" || rc="$?"
if ! [ "$rc" -eq 0 ]
then
1>&2 echo "Bootstrap command failed: $@"
exit "$rc"
fi
}
rust_version=$(cat ./rust-toolchain.toml | sed -n 's/^channel[[:space:]]*=[[:space:]]"\(.*\)"/\1/p')
echo "using rust version '$rust_version'"
# here we set the toolchain to 'none' and rustup will pick up on ./rust-toolchain.toml
run curl --fail https://sh.rustup.rs -sSf | run sh -s -- -y --default-toolchain "none" --no-modify-path
echo "looking for ic-wasm 0.3.5"
if [[ ! "$(command -v ic-wasm)" || "$(ic-wasm --version)" != "ic-wasm 0.3.5" ]]
then
echo "installing ic-wasm 0.3.5"
run cargo install ic-wasm --version 0.3.5
fi
The command for build it is:
docker buildx build --platform=linux/amd64 -t {{image-name}} . --output type=docker
Run command:
docker run --platform linux/amd64 --name {{container-name}} -it {{image-name}} bash