浏览代码

Merge pull request #373 from PabloCastellano/more-docker

Multiple improvements in docker image
Nathan.fooo 3 年之前
父节点
当前提交
03192f8d7e
共有 3 个文件被更改,包括 45 次插入18 次删除
  1. 17 3
      README.md
  2. 17 15
      frontend/scripts/docker-buildfiles/Dockerfile
  3. 11 0
      frontend/scripts/docker-buildfiles/README.md

+ 17 - 3
README.md

@@ -20,14 +20,28 @@ You are in charge of your data and customizations.
 <p align="center">
     <a href="http://www.appflowy.io"><b>Website</b></a> •
     <a href="https://discord.gg/9Q2xaN37tV"><b>Discord</b></a> •
-    <a href="https://twitter.com/appflowy"><b>Twitter</b></a> 
-</p>  
+    <a href="https://twitter.com/appflowy"><b>Twitter</b></a>
+</p>
 
 <p align="center"><img src="https://github.com/AppFlowy-IO/appflowy/blob/main/doc/imgs/welcome.png" alt="The Open Source Alternative To Notion." width="1000px" /></p>
 
 ## User Installation
+
 Please view the [documentation](https://appflowy.gitbook.io/docs/essential-documentation/install-appflowy/installation-methods) for OS specific installation instructions.
 
+You can also try AppFlowy using the docker image:
+
+```
+docker run --rm \
+  -v $HOME/.Xauthority:/root/.Xauthority:rw \
+  -v /tmp/.X11-unix:/tmp/.X11-unix \
+  -v /dev/dri:/dev/dri \
+  -v /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket \
+  -v appflowy-data:/home/appflowy \
+  -e DISPLAY=${DISPLAY} \
+  appflowyio/appflowy_client:latest
+```
+
 ## Built With
 
 * [Flutter](https://flutter.dev/)
@@ -85,4 +99,4 @@ Distributed under the AGPLv3 License. See `LICENSE.md` for more information.
 Special thanks to these amazing projects which help power AppFlowy.IO:
 
 - [flutter-quill](https://github.com/singerdmx/flutter-quill)
-- [cargo-make](https://github.com/sagiegurari/cargo-make)
+- [cargo-make](https://github.com/sagiegurari/cargo-make)

+ 17 - 15
frontend/scripts/docker-buildfiles/Dockerfile

@@ -6,7 +6,7 @@ RUN pacman -Syu --needed --noconfirm git xdg-user-dirs
 
 # makepkg user and workdir
 ARG user=makepkg
-ENV PATH="/home/makepkg/.pub-cache/bin:/home/makepkg/.local/flutter/bin:/home/makepkg/.local/flutter/bin/cache/dart-sdk/bin:${PATH}"
+ENV PATH="/home/$user/.pub-cache/bin:/home/$user/.local/flutter/bin:/home/$user/.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
@@ -15,9 +15,7 @@ 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
+  && makepkg -sri --needed --noconfirm
 
 RUN yay -S --noconfirm curl base-devel sqlite openssl clang cmake ninja pkg-config gtk3 unzip
 RUN xdg-user-dirs-update
@@ -40,21 +38,25 @@ cargo make -p production-linux-x86 appflowy-linux
 CMD ["/home/makepkg/appflowy/frontend/app_flowy/build/linux/x64/release/bundle/app_flowy"]
 
 #################
-FROM archlinux/archlinux:base-devel
+FROM archlinux/archlinux
 
-RUN pacman -Syy
-RUN pacman -Syu --needed --noconfirm xdg-user-dirs
+RUN pacman -Syy && \
+    pacman -Syu --needed --noconfirm xdg-user-dirs && \
+    pacman -Scc --noconfirm
 RUN xdg-user-dirs-update
 
-ARG user=makepkg
-RUN useradd --system --create-home $user \
-  && echo "$user ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers.d/$user
-USER $user
-WORKDIR /home/$user
-
 COPY --from=builder /usr/sbin/yay /usr/sbin/yay
 RUN yay -S --noconfirm gtk3
 
-COPY --from=builder /home/makepkg/appflowy/frontend/app_flowy/build/linux/x64/release/bundle ./AppFlowy
+ARG user=appflowy
+ARG uid=1000
+ARG gid=1000
+
+RUN groupadd --gid $gid appflowy
+RUN useradd --create-home --uid $uid --gid $gid $user
+USER $user
+WORKDIR /home/$user
+
+COPY --from=builder /home/makepkg/appflowy/frontend/app_flowy/build/linux/x64/release/bundle/ .
 
-CMD ["/home/makepkg/AppFlowy/app_flowy"]
+CMD ["./app_flowy"]

+ 11 - 0
frontend/scripts/docker-buildfiles/README.md

@@ -0,0 +1,11 @@
+# Docker image
+
+Build AppFlowy docker image using the following command:
+
+```
+docker-compose build --build-arg uid=$(id -u) --build-arg gid=$(id -g)
+```
+
+For more information, check out our documentation:
+
+https://appflowy.gitbook.io/docs/essential-documentation/install-appflowy/installation-methods/installing-with-docker