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
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-09-25 15:25:44 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# Install Rust and dependencies using pacman
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								RUN sudo pacman -S --needed --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 && \
							 | 
						
					
						
							
								
									
										
										
										
											2024-09-25 15:25:44 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    rustup toolchain install 1.80.1 && \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    rustup default 1.80.1
							 | 
						
					
						
							
								
									
										
										
										
											2023-04-10 23:26:04 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Install Flutter
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								RUN sudo pacman -S --noconfirm git tar gtk3
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								RUN curl -sSfL \
							 | 
						
					
						
							
								
									
										
										
										
											2024-09-25 15:25:44 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    --output flutter.tar.xz \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.22.0-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-12-10 21:26:53 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								RUN dart pub global activate protoc_plugin 21.1.2
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-23 14:30:03 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-09-25 15:25:44 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# Install build dependencies for AppFlowy using pacman
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								RUN sudo pacman -S --needed --noconfirm jemalloc git libkeybinder3 sqlite clang rsync libnotify rocksdb zstd mpv
							 | 
						
					
						
							
								
									
										
										
										
											2023-10-23 17:47:11 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								RUN sudo ln -s /usr/bin/sha1sum /usr/bin/shasum
							 | 
						
					
						
							
								
									
										
										
										
											2024-09-25 15:25:44 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								RUN source ~/.cargo/env && cargo install cargo-make cargo-binstall
							 | 
						
					
						
							
								
									
										
										
										
											2023-10-23 17:47:11 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								RUN source ~/.cargo/env && cargo binstall duckscript_cli -y
							 | 
						
					
						
							
								
									
										
										
										
											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-10-23 17:47:11 +03:30
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    OPENSSL_STATIC=1 ZSTD_SYS_USE_PKG_CONFIG=1 ROCKSDB_LIB_DIR="/usr/lib/" cargo make -p production-linux-x86_64 appflowy-linux
							 | 
						
					
						
							
								
									
										
										
										
											2023-04-10 23:26:04 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#================
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# 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
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-30 16:28:09 +09:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								RUN pacman -S --noconfirm xdg-user-dirs gtk3 libkeybinder3 libnotify rocksdb && \
							 | 
						
					
						
							
								
									
										
										
										
											2023-04-10 23:26:04 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    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"]
							 |