Dockerfile 2.6 KB

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