Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

Added support for docker image in docs/docker-buildfiles (#164)

Rushi Chaudhari3d67c0698a4c
diff --git a/doc/BUILD_ON_DOCKER.md b/doc/BUILD_ON_DOCKER.md
new file mode 100644
index 0000000000..ebb16c5ec8
--- /dev/null
+++ b/doc/BUILD_ON_DOCKER.md
@@ -0,0 +1,43 @@
+### Note:-
+
+- Make sure you already have docker and docker-compose fully working before this. For Arch you can read here [Docker Arch linux docs](https://wiki.archlinux.org/title/Docker)
+- Don't forget to add your username to docker group to run docker without sudo. To do that, on Arch,
+ `sudo usermod -aG docker yoursername` and reboot is a must.
+- This build is also based on the Arch linux build
+- Any Linux/ Mac machine should work, because you need to
+ `xhost local:root` I'm not sure if Windows support this
+- There is no need of cloning the whole repo, you can also create a new directory and paste the Dockerfile and docker-compose.yml from `appflowy/doc/docker-buildfiles`.
+
+- Once the docker image has been built, `docker-compose up` from the directory would be enough to run the appflowy container next time.
+
+# Steps:
+
+## Step 1: clone the repository
+
+```{bash}
+git clone https://github.com/AppFlowy-IO/appflowy.git
+```
+
+## Step 2: cd into docker-buildfiles
+
+```{bash}
+cd ./appflowy/doc/docker-buildfiles
+```
+
+## Step 3: Provide access of appflowy to X session
+
+```{bash}
+xhost local:root
+```
+
+## Step 4: build the docker image
+
+```{bash}
+docker-compose build
+```
+
+## Step 5: run the docker container
+
+```{bash}
+docker-compose up
+```
diff --git a/doc/docker-buildfiles/Dockerfile b/doc/docker-buildfiles/Dockerfile
new file mode 100755
index 0000000000..dcfd7a03bb
--- /dev/null
+++ b/doc/docker-buildfiles/Dockerfile
@@ -0,0 +1,36 @@
+FROM archlinux/archlinux:base-devel
+
+RUN pacman -Syu --needed --noconfirm git xdg-user-dirs
+
+# makepkg user and workdir
+ARG user=makepkg
+ENV PATH="/home/makepkg/.local/flutter/bin:/home/makepkg/.local/flutter/bin/cache/dart-sdk/bin:${PATH}"
+RUN useradd --system --create-home $user \
+ && echo "$user ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers.d/$user
+USER $user
+WORKDIR /home/$user
+
+# Install yay
+RUN git clone https://aur.archlinux.org/yay.git \
+ && cd yay \
+ && makepkg -sri --needed --noconfirm \
+ && cd \
+ && rm -rf .cache yay
+
+RUN yay -S --noconfirm curl base-devel sqlite openssl clang cmake ninja pkg-config gtk3 unzip
+RUN xdg-user-dirs-update
+RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
+RUN source $HOME/.cargo/env && rustup toolchain install nightly && rustup default nightly
+RUN git clone https://github.com/flutter/flutter.git $HOME/.local/flutter
+RUN flutter channel stable
+RUN flutter config --enable-linux-desktop
+RUN flutter doctor
+
+RUN git clone https://github.com/AppFlowy-IO/appflowy.git && \
+cd appflowy/frontend && \
+source $HOME/.cargo/env && \
+cargo install --force cargo-make && \
+cargo install --force duckscript_cli && \
+cargo make flowy_dev && \
+cargo make -p production-linux-x86 appflowy-linux
+CMD ["appflowy/frontend/app_flowy/product/0.0.2/linux/Release/AppFlowy/app_flowy"]
\ No newline at end of file
diff --git a/doc/docker-buildfiles/docker-compose.yml b/doc/docker-buildfiles/docker-compose.yml
new file mode 100755
index 0000000000..67fb26ab9f
--- /dev/null
+++ b/doc/docker-buildfiles/docker-compose.yml
@@ -0,0 +1,12 @@
+version: "3"
+
+services:
+ app:
+ build: .
+ stdin_open: true
+ # tty: true
+ environment:
+ - DISPLAY=${DISPLAY}
+ volumes:
+ - $HOME/.Xauthority:/root/.Xauthority:rw
+ network_mode: host
\ No newline at end of file