From b5bfa3ac8c9a580e5486c7a7d5a91c5dca29234f Mon Sep 17 00:00:00 2001 From: Efim Poberezkin Date: Sun, 21 Feb 2021 19:59:52 +0400 Subject: [PATCH] add Dockerfile for building chat executable and instructions on running it (#48) * [WIP] add instructions how to build project inside docker container * docker run -> docker create * add Dockerfile for building chat executable and instructions --- Dockerfile | 10 ++++++++++ README.md | 21 ++++++++++++++++----- 2 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..c03da4ac63 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM haskell:8.8.4 AS build-stage +# if you encounter "version `GLIBC_2.28' not found" error when running +# chat client executable, build with the following base image instead: +# FROM haskell:8.8.4-stretch AS build-stage +COPY . /project +WORKDIR /project +RUN stack install + +FROM scratch AS export-stage +COPY --from=build-stage /root/.local/bin/dog-food / diff --git a/README.md b/README.md index ad2e8423bc..37be83c6d5 100644 --- a/README.md +++ b/README.md @@ -34,19 +34,30 @@ $ stack install $ dog-food ``` +If you'd prefer to not set up Haskell locally, you may instead build the chat client executable using [docker build with custom output](https://docs.docker.com/engine/reference/commandline/build/#custom-build-outputs): + +```shell +$ git clone git@github.com:simplex-chat/simplex-messaging.git +$ cd simplex-messaging +$ DOCKER_BUILDKIT=1 docker build --output ~/.local/bin . +$ dog-food +``` + +> **NOTE:** when running chat client executable built with the latter approach, if you encounter ``version `GLIBC_2.28' not found`` error, rebuild it with `haskell:8.8.4-stretch` base image instead (you'd have to change it in your local [Dockerfile](Dockerfile)). + `dog-food` (as in "eating your own dog food" - it is an early prototype) starts chat client with default parameters. By default, SQLite database file is created in the working directory (`smp-chat.db`), and the default SMP server is `smp.simplex.im:5223`. To specify a different chat database location run: -```bash -mkdir ~/simplex -dog-food -d ~/simplex/my-chat.db +```shell +$ mkdir ~/simplex +$ dog-food -d ~/simplex/my-chat.db ``` You can deploy your own server and set client to use it via command line option: -```bash -dog-food -s smp.example.com:5223 +```shell +$ dog-food -s smp.example.com:5223 ``` You can still talk to people using default or any other server, it only affects the location of the message queue when you initiate the connection (and the reply queue can be on another server, as set by the other party's client).