Browse Source

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

* added docker

* updated cleaner dockercompose

* readme

* changed docker readme

* noconfirm removed
Rushi Chaudhari 3 years ago
parent
commit
3d67c0698a
3 changed files with 91 additions and 0 deletions
  1. 43 0
      doc/BUILD_ON_DOCKER.md
  2. 36 0
      doc/docker-buildfiles/Dockerfile
  3. 12 0
      doc/docker-buildfiles/docker-compose.yml

+ 43 - 0
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
+```

+ 36 - 0
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"]

+ 12 - 0
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