Dockerfile 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #================
  2. # BUILDER
  3. #================
  4. FROM archlinux/archlinux:base-devel as builder
  5. # Upgrade the system
  6. RUN pacman -Syyu --noconfirm
  7. # Set up makepkg user and workdir
  8. ARG user=makepkg
  9. RUN pacman -S --needed --noconfirm sudo
  10. RUN useradd --system --create-home $user && \
  11. echo "$user ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers
  12. ENV PATH="/home/$user/.pub-cache/bin:/home/$user/flutter/bin:/home/$user/flutter/bin/cache/dart-sdk/bin:${PATH}"
  13. USER $user
  14. WORKDIR /home/$user
  15. # Install yay
  16. RUN sudo pacman -S --needed --noconfirm curl tar
  17. RUN curl -sSfL \
  18. --output yay.tar.gz \
  19. https://github.com/Jguer/yay/releases/download/v12.0.2/yay_12.0.2_x86_64.tar.gz && \
  20. tar -xf yay.tar.gz && \
  21. sudo mv yay_12.0.2_x86_64/yay /bin && \
  22. rm -rf yay_12.0.2_x86_64 && \
  23. yay --version
  24. # Install Rust
  25. RUN yay -S --noconfirm curl base-devel openssl clang cmake ninja pkg-config xdg-user-dirs
  26. RUN xdg-user-dirs-update
  27. RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
  28. RUN source ~/.cargo/env && \
  29. rustup toolchain install stable && \
  30. rustup default stable
  31. # Install Flutter
  32. RUN sudo pacman -S --noconfirm git tar gtk3
  33. RUN curl -sSfL \
  34. --output flutter.tar.xz \
  35. https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.7.5-stable.tar.xz && \
  36. tar -xf flutter.tar.xz && \
  37. rm flutter.tar.xz
  38. RUN flutter config --enable-linux-desktop
  39. RUN flutter doctor
  40. RUN dart pub global activate protoc_plugin
  41. # Intall build dependencies for AppFlowy
  42. RUN sudo pacman -S --noconfirm git libkeybinder3 sqlite
  43. RUN source ~/.cargo/env && cargo install --force cargo-make duckscript_cli
  44. # Build AppFlowy
  45. COPY . /appflowy
  46. RUN sudo chown -R $user: /appflowy
  47. WORKDIR /appflowy
  48. RUN cd frontend && \
  49. source ~/.cargo/env && \
  50. cargo make appflowy-flutter-deps-tools && \
  51. cargo make -p production-linux-x86_64 appflowy-linux
  52. #================
  53. # APP
  54. #================
  55. FROM archlinux/archlinux
  56. # Upgrade the system
  57. RUN pacman -Syyu --noconfirm
  58. # Install runtime dependencies
  59. RUN pacman -S --noconfirm xdg-user-dirs gtk3 libkeybinder3 && \
  60. pacman -Scc --noconfirm
  61. # Set up appflowy user
  62. ARG user=appflowy
  63. ARG uid=1000
  64. ARG gid=1000
  65. RUN groupadd --gid $gid $user
  66. RUN useradd --create-home --uid $uid --gid $gid $user
  67. USER $user
  68. # Set up the AppFlowy app
  69. WORKDIR /home/$user
  70. COPY --from=builder /appflowy/frontend/appflowy_flutter/build/linux/x64/release/bundle .
  71. RUN xdg-user-dirs-update && \
  72. test -e ./AppFlowy && \
  73. file ./AppFlowy
  74. CMD ["./AppFlowy"]