| 
									
										
										
										
											2023-04-10 23:26:04 -03:00
										 |  |  | #================
 | 
					
						
							|  |  |  | # BUILDER
 | 
					
						
							|  |  |  | #================
 | 
					
						
							| 
									
										
										
										
											2021-12-23 14:30:03 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-10 23:26:04 -03:00
										 |  |  | FROM archlinux/archlinux:base-devel as builder
 | 
					
						
							| 
									
										
										
										
											2023-06-09 19:48:16 +08:00
										 |  |  | RUN chown root:root /usr/bin/sudo && chmod 4755 /usr/bin/sudo
 | 
					
						
							| 
									
										
										
										
											2021-12-28 15:10:53 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-10 23:26:04 -03:00
										 |  |  | # Upgrade the system
 | 
					
						
							|  |  |  | RUN pacman -Syyu --noconfirm
 | 
					
						
							| 
									
										
										
										
											2021-12-23 14:30:03 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-10 23:26:04 -03:00
										 |  |  | # Set up makepkg user and workdir
 | 
					
						
							| 
									
										
										
										
											2021-12-23 14:30:03 -05:00
										 |  |  | ARG user=makepkg | 
					
						
							| 
									
										
										
										
											2023-04-10 23:26:04 -03:00
										 |  |  | RUN pacman -S --needed --noconfirm sudo
 | 
					
						
							|  |  |  | RUN useradd --system --create-home $user && \
 | 
					
						
							|  |  |  |     echo "$user ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers
 | 
					
						
							|  |  |  | ENV PATH="/home/$user/.pub-cache/bin:/home/$user/flutter/bin:/home/$user/flutter/bin/cache/dart-sdk/bin:${PATH}"
 | 
					
						
							| 
									
										
										
										
											2021-12-23 14:30:03 -05:00
										 |  |  | USER $user
 | 
					
						
							|  |  |  | WORKDIR /home/$user
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Install yay
 | 
					
						
							| 
									
										
										
										
											2023-04-10 23:26:04 -03:00
										 |  |  | RUN sudo pacman -S --needed --noconfirm curl tar
 | 
					
						
							|  |  |  | RUN curl -sSfL \
 | 
					
						
							|  |  |  |     --output yay.tar.gz \
 | 
					
						
							|  |  |  |     https://github.com/Jguer/yay/releases/download/v12.0.2/yay_12.0.2_x86_64.tar.gz && \
 | 
					
						
							|  |  |  |   tar -xf yay.tar.gz && \
 | 
					
						
							|  |  |  |   sudo mv yay_12.0.2_x86_64/yay /bin && \
 | 
					
						
							|  |  |  |   rm -rf yay_12.0.2_x86_64 && \
 | 
					
						
							|  |  |  |   yay --version
 | 
					
						
							| 
									
										
										
										
											2021-12-23 14:30:03 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-10 23:26:04 -03:00
										 |  |  | # Install Rust
 | 
					
						
							|  |  |  | RUN yay -S --noconfirm curl base-devel openssl clang cmake ninja pkg-config xdg-user-dirs
 | 
					
						
							| 
									
										
										
										
											2021-12-23 14:30:03 -05:00
										 |  |  | RUN xdg-user-dirs-update
 | 
					
						
							|  |  |  | RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
 | 
					
						
							| 
									
										
										
										
											2023-04-10 23:26:04 -03:00
										 |  |  | RUN source ~/.cargo/env && \
 | 
					
						
							| 
									
										
										
										
											2023-06-15 22:43:07 +08:00
										 |  |  |     rustup toolchain install 1.70 && \
 | 
					
						
							|  |  |  |     rustup default 1.70
 | 
					
						
							| 
									
										
										
										
											2023-04-10 23:26:04 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | # Install Flutter
 | 
					
						
							|  |  |  | RUN sudo pacman -S --noconfirm git tar gtk3
 | 
					
						
							|  |  |  | RUN curl -sSfL \
 | 
					
						
							|  |  |  |       --output flutter.tar.xz \
 | 
					
						
							| 
									
										
										
										
											2023-05-28 05:09:39 +01:00
										 |  |  |       https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.10.1-stable.tar.xz && \
 | 
					
						
							| 
									
										
										
										
											2023-04-10 23:26:04 -03:00
										 |  |  |     tar -xf flutter.tar.xz && \
 | 
					
						
							|  |  |  |     rm flutter.tar.xz
 | 
					
						
							| 
									
										
										
										
											2022-02-17 20:40:17 +01:00
										 |  |  | RUN flutter config --enable-linux-desktop
 | 
					
						
							|  |  |  | RUN flutter doctor
 | 
					
						
							| 
									
										
										
										
											2023-06-15 22:43:07 +08:00
										 |  |  | RUN dart pub global activate protoc_plugin 20.0.1
 | 
					
						
							| 
									
										
										
										
											2021-12-23 14:30:03 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-12 18:28:53 +09:00
										 |  |  | # Install build dependencies for AppFlowy
 | 
					
						
							| 
									
										
										
										
											2023-10-02 20:48:56 +08:00
										 |  |  | RUN sudo pacman -S --noconfirm git libkeybinder3 sqlite clang rsync libnotify
 | 
					
						
							| 
									
										
										
										
											2023-04-10 23:26:04 -03:00
										 |  |  | RUN source ~/.cargo/env && cargo install --force cargo-make duckscript_cli
 | 
					
						
							| 
									
										
										
										
											2022-02-17 18:05:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-10 23:26:04 -03:00
										 |  |  | # Build AppFlowy
 | 
					
						
							|  |  |  | COPY . /appflowy
 | 
					
						
							|  |  |  | RUN sudo chown -R $user: /appflowy
 | 
					
						
							|  |  |  | WORKDIR /appflowy
 | 
					
						
							|  |  |  | RUN cd frontend && \
 | 
					
						
							|  |  |  |     source ~/.cargo/env && \
 | 
					
						
							|  |  |  |     cargo make appflowy-flutter-deps-tools && \
 | 
					
						
							| 
									
										
										
										
											2023-06-15 22:43:07 +08:00
										 |  |  |     cargo make flutter_clean && \
 | 
					
						
							| 
									
										
										
										
											2023-04-10 23:26:04 -03:00
										 |  |  |     cargo make -p production-linux-x86_64 appflowy-linux
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #================
 | 
					
						
							|  |  |  | # APP
 | 
					
						
							|  |  |  | #================
 | 
					
						
							| 
									
										
										
										
											2022-02-17 18:05:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-23 11:59:35 +01:00
										 |  |  | FROM archlinux/archlinux
 | 
					
						
							| 
									
										
										
										
											2022-02-17 18:05:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-10 23:26:04 -03:00
										 |  |  | # Upgrade the system
 | 
					
						
							|  |  |  | RUN pacman -Syyu --noconfirm
 | 
					
						
							| 
									
										
										
										
											2022-02-17 18:05:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-10 23:26:04 -03:00
										 |  |  | # Install runtime dependencies
 | 
					
						
							|  |  |  | RUN pacman -S --noconfirm xdg-user-dirs gtk3 libkeybinder3 && \
 | 
					
						
							|  |  |  |     pacman -Scc --noconfirm
 | 
					
						
							| 
									
										
										
										
											2022-02-17 18:05:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-10 23:26:04 -03:00
										 |  |  | # Set up appflowy user
 | 
					
						
							| 
									
										
										
										
											2022-02-23 11:59:35 +01:00
										 |  |  | ARG user=appflowy | 
					
						
							|  |  |  | ARG uid=1000 | 
					
						
							|  |  |  | ARG gid=1000 | 
					
						
							| 
									
										
										
										
											2023-04-10 23:26:04 -03:00
										 |  |  | RUN groupadd --gid $gid $user
 | 
					
						
							| 
									
										
										
										
											2022-02-23 11:59:35 +01:00
										 |  |  | RUN useradd --create-home --uid $uid --gid $gid $user
 | 
					
						
							|  |  |  | USER $user
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-10 23:26:04 -03:00
										 |  |  | # Set up the AppFlowy app
 | 
					
						
							|  |  |  | WORKDIR /home/$user
 | 
					
						
							|  |  |  | COPY --from=builder /appflowy/frontend/appflowy_flutter/build/linux/x64/release/bundle .
 | 
					
						
							|  |  |  | RUN xdg-user-dirs-update && \
 | 
					
						
							|  |  |  |     test -e ./AppFlowy && \
 | 
					
						
							|  |  |  |     file ./AppFlowy
 | 
					
						
							| 
									
										
										
										
											2022-02-17 18:05:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-10 23:26:04 -03:00
										 |  |  | CMD ["./AppFlowy"]
 |