Dockerfile 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 1.70 && \
  31. rustup default 1.70
  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 20.0.1
  42. # Intall build dependencies for AppFlowy
  43. RUN sudo pacman -S --noconfirm git libkeybinder3 sqlite clang
  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 flutter_clean && \
  53. cargo make -p production-linux-x86_64 appflowy-linux
  54. #================
  55. # APP
  56. #================
  57. FROM archlinux/archlinux
  58. # Upgrade the system
  59. RUN pacman -Syyu --noconfirm
  60. # Install runtime dependencies
  61. RUN pacman -S --noconfirm xdg-user-dirs gtk3 libkeybinder3 && \
  62. pacman -Scc --noconfirm
  63. # Set up appflowy user
  64. ARG user=appflowy
  65. ARG uid=1000
  66. ARG gid=1000
  67. RUN groupadd --gid $gid $user
  68. RUN useradd --create-home --uid $uid --gid $gid $user
  69. USER $user
  70. # Set up the AppFlowy app
  71. WORKDIR /home/$user
  72. COPY --from=builder /appflowy/frontend/appflowy_flutter/build/linux/x64/release/bundle .
  73. RUN xdg-user-dirs-update && \
  74. test -e ./AppFlowy && \
  75. file ./AppFlowy
  76. CMD ["./AppFlowy"]