Git Product home page Git Product logo

func_docker's Introduction

Dockerfile for FunC testing

This docker image should come in handy to run toncli with the new tests support.
Setting it all up manually could be cumbersome otherwise.
Inspired by Dockerfile for the Open Network Node.
Built on Ubuntu 20.04 so should be WSL docker compatible.

Pre-built images

Pre-built images availabe. Mult-arch supported x86_64 (amd64) and arm64/v8 (M1 compatible!).
https://hub.docker.com/r/trinketer22/func_docker/

  • main is the image from master(this) branch.
  • slim is extremely small image (< 50MB compressed) from slim branch.

Install pre-built images

Run:docker pull trinketer22/func_docker to install main image.
or
Run docker pull trinketer22/func_docker:slim to install slim image.

Run docker tag trinketer22/func_docker toncli-local to give an alias toncli-local for the image trinketer22/func_docker.

Then you may go straight to Usage.

Build

To build an image run: docker build . -t toncli-local [ optional --build-arg ]
Where toncli-local would be an image name.

In most cases that's it. However, if you need something special, there are custom build arguments available.

Custom build arguments

  • TON_GIT specifies git repo url to fetch sources from. SpyCheese by default.
  • TON_BRANCH specifies git branch to fetch from. Set to toncli-local by default so would likely require change if alternate TON_GIT is set.
  • BUILD_DEBUG is self-explaintatory. By default Release binaries are built. Set BUILD_DEBUG=1 to build debug binaries.
  • CUSTOM_CMAKE Overrides build process cmake flags. Use it at your own risk.

Example of building debug binaries from ton-blockchain/ton testnet branch

docker build . -t toncli-local \
--build-arg TON_GIT=https://github.com/ton-blockchain/ton \
--build-arg TON_BRANCH=testnet \
--build-arg BUILD_DEBUG=1

Use

You're going to need to pass your workdir as a volume to make things happen

Creating project

Run

docker run --rm -it \
-v ~/Dev:/code \
toncli-local start --name test_project wallet 

You're going to see the toncli project structure in ~/Dev/test_project
README.md build fift func project.yaml tests

Building

Run

docker run --rm -it \
-v ~/Dev/test_project:/code \
toncli-local build

Running tests

docker run --rm -it \
-v ~/Dev/test_project:/code \
toncli-local run_tests

Deploying contract

Now here is the tricky part.
Toncli stores deployment info in it's config directory instead of your project directory.
So we're going to have to create another volume for that to persist.

Run

docker run --rm -it \
-v ~/Dev/test_project:/code \
-v /path/to/toncli_conf_dir/:/root/.config \
toncli-local update_libs

After that you should go through standard toncli initialization dialog and pass absolute paths to the binaries

  • /usr/local/bin/func
  • /usr/local/bin/fift
  • /usr/local/bin/lite-client

Don't get confused those path's are inside the docker image and not your local system.
After that you should get an initialized toncli directory on your local system at /path/to/toncli_conf_dir/toncli.
Looking like:

config.ini
fift-libs
func-libs
test-libs

Now you can use it in the deploy or any other process like so.

Run

docker run --rm -it \
-v /path/to/project:/code \
-v /path/to/toncli_conf_dir/:/root/.config \
toncli-local deploy --net testnet

wallet directory would be created inside your local config dir with all the usefull deployment information

General usage

docker run --rm -it \
-v <code_volume> \
-v [optional config volume] \
<docker image name> \
<toncli command you want to run>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.