mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
Fix the app's Dockerfile and comment it (#2162)
* chore: fix the app's Dockerfile and comment it * chore: test docker-compose on CI
This commit is contained in:
parent
1cbedb3277
commit
662d11b3b1
@ -1,4 +1 @@
|
|||||||
frontend/appflowy_flutter/
|
.git
|
||||||
frontend/scripts/
|
|
||||||
frontend/rust-lib/target
|
|
||||||
shared-lib/target/
|
|
||||||
|
47
.github/workflows/docker_ci.yml
vendored
Normal file
47
.github/workflows/docker_ci.yml
vendored
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
name: Docker-CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- release/*
|
||||||
|
paths:
|
||||||
|
- frontend/**
|
||||||
|
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- release/*
|
||||||
|
paths:
|
||||||
|
- frontend/**
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
- reopened
|
||||||
|
- unlocked
|
||||||
|
- ready_for_review
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-app:
|
||||||
|
if: github.event.pull_request.draft != true
|
||||||
|
concurrency:
|
||||||
|
group: docker_ci-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout source code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Build the app
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -eu -o pipefail
|
||||||
|
cd frontend/scripts/docker-buildfiles
|
||||||
|
docker-compose build --no-cache --progress=plain \
|
||||||
|
| while read line; do \
|
||||||
|
if [[ "$line" =~ ^Step[[:space:]] ]]; then \
|
||||||
|
echo "$(date -u '+%H:%M:%S') | $line"; \
|
||||||
|
else \
|
||||||
|
echo "$line"; \
|
||||||
|
fi; \
|
||||||
|
done \
|
@ -1,63 +1,90 @@
|
|||||||
|
#================
|
||||||
|
# BUILDER
|
||||||
|
#================
|
||||||
|
|
||||||
FROM archlinux/archlinux:base-devel as builder
|
FROM archlinux/archlinux:base-devel as builder
|
||||||
|
|
||||||
RUN pacman -Syy
|
# Upgrade the system
|
||||||
|
RUN pacman -Syyu --noconfirm
|
||||||
|
|
||||||
RUN pacman -Syu --needed --noconfirm git xdg-user-dirs
|
# Set up makepkg user and workdir
|
||||||
|
|
||||||
# makepkg user and workdir
|
|
||||||
ARG user=makepkg
|
ARG user=makepkg
|
||||||
ENV PATH="/home/$user/.pub-cache/bin:/home/$user/.local/flutter/bin:/home/$user/.local/flutter/bin/cache/dart-sdk/bin:${PATH}"
|
RUN pacman -S --needed --noconfirm sudo
|
||||||
RUN useradd --system --create-home $user \
|
RUN useradd --system --create-home $user && \
|
||||||
&& echo "$user ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers.d/$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}"
|
||||||
USER $user
|
USER $user
|
||||||
WORKDIR /home/$user
|
WORKDIR /home/$user
|
||||||
|
|
||||||
# Install yay
|
# Install yay
|
||||||
RUN git clone https://aur.archlinux.org/yay.git \
|
RUN sudo pacman -S --needed --noconfirm curl tar
|
||||||
&& cd yay \
|
RUN curl -sSfL \
|
||||||
&& makepkg -sri --needed --noconfirm
|
--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
|
||||||
|
|
||||||
RUN yay -S --noconfirm curl base-devel sqlite openssl clang cmake ninja pkg-config gtk3 unzip
|
# Install Rust
|
||||||
|
RUN yay -S --noconfirm curl base-devel openssl clang cmake ninja pkg-config xdg-user-dirs
|
||||||
RUN xdg-user-dirs-update
|
RUN xdg-user-dirs-update
|
||||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||||
RUN source $HOME/.cargo/env && rustup toolchain install stable && rustup default stable
|
RUN source ~/.cargo/env && \
|
||||||
RUN git clone https://github.com/flutter/flutter.git $HOME/.local/flutter
|
rustup toolchain install stable && \
|
||||||
RUN flutter channel stable
|
rustup default stable
|
||||||
|
|
||||||
|
# Install Flutter
|
||||||
|
RUN sudo pacman -S --noconfirm git tar gtk3
|
||||||
|
RUN curl -sSfL \
|
||||||
|
--output flutter.tar.xz \
|
||||||
|
https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.7.5-stable.tar.xz && \
|
||||||
|
tar -xf flutter.tar.xz && \
|
||||||
|
rm flutter.tar.xz
|
||||||
RUN flutter config --enable-linux-desktop
|
RUN flutter config --enable-linux-desktop
|
||||||
RUN flutter doctor
|
RUN flutter doctor
|
||||||
RUN dart pub global activate protoc_plugin
|
RUN dart pub global activate protoc_plugin
|
||||||
RUN sudo pacman -Syu --needed --noconfirm git xdg-user-dirs libkeybinder3
|
|
||||||
|
|
||||||
RUN git clone https://github.com/AppFlowy-IO/appflowy.git && \
|
# Intall build dependencies for AppFlowy
|
||||||
cd appflowy/frontend && \
|
RUN sudo pacman -S --noconfirm git libkeybinder3 sqlite
|
||||||
source $HOME/.cargo/env && \
|
RUN source ~/.cargo/env && cargo install --force cargo-make duckscript_cli
|
||||||
cargo install --force cargo-make && \
|
|
||||||
cargo install --force duckscript_cli && \
|
|
||||||
cargo make appflowy-flutter-deps-tools && \
|
|
||||||
cargo make -p production-linux-x86_64 appflowy-linux
|
|
||||||
|
|
||||||
CMD ["/home/makepkg/appflowy/frontend/appflowy_flutter/build/linux/x64/release/bundle/appflowy_flutter"]
|
# Build AppFlowy
|
||||||
|
COPY . /appflowy
|
||||||
|
RUN sudo chown -R $user: /appflowy
|
||||||
|
WORKDIR /appflowy
|
||||||
|
RUN cd frontend && \
|
||||||
|
source ~/.cargo/env && \
|
||||||
|
cargo make appflowy-flutter-deps-tools && \
|
||||||
|
cargo make -p production-linux-x86_64 appflowy-linux
|
||||||
|
|
||||||
|
|
||||||
|
#================
|
||||||
|
# APP
|
||||||
|
#================
|
||||||
|
|
||||||
#################
|
|
||||||
FROM archlinux/archlinux
|
FROM archlinux/archlinux
|
||||||
|
|
||||||
RUN pacman -Syy && \
|
# Upgrade the system
|
||||||
pacman -Syu --needed --noconfirm xdg-user-dirs && \
|
RUN pacman -Syyu --noconfirm
|
||||||
|
|
||||||
|
# Install runtime dependencies
|
||||||
|
RUN pacman -S --noconfirm xdg-user-dirs gtk3 libkeybinder3 && \
|
||||||
pacman -Scc --noconfirm
|
pacman -Scc --noconfirm
|
||||||
RUN xdg-user-dirs-update
|
|
||||||
|
|
||||||
COPY --from=builder /usr/sbin/yay /usr/sbin/yay
|
|
||||||
RUN yay -S --noconfirm gtk3 libkeybinder3
|
|
||||||
|
|
||||||
|
# Set up appflowy user
|
||||||
ARG user=appflowy
|
ARG user=appflowy
|
||||||
ARG uid=1000
|
ARG uid=1000
|
||||||
ARG gid=1000
|
ARG gid=1000
|
||||||
|
RUN groupadd --gid $gid $user
|
||||||
RUN groupadd --gid $gid appflowy
|
|
||||||
RUN useradd --create-home --uid $uid --gid $gid $user
|
RUN useradd --create-home --uid $uid --gid $gid $user
|
||||||
USER $user
|
USER $user
|
||||||
|
|
||||||
|
# Set up the AppFlowy app
|
||||||
WORKDIR /home/$user
|
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
|
||||||
|
|
||||||
COPY --from=builder /home/makepkg/appflowy/frontend/appflowy_flutter/build/linux/x64/release/bundle/ .
|
CMD ["./AppFlowy"]
|
||||||
|
|
||||||
CMD ["./appflowy_flutter"]
|
|
||||||
|
@ -1,23 +1,27 @@
|
|||||||
version: "3"
|
version: "3"
|
||||||
|
|
||||||
|
# NOTE: Docker should be allowed to connect to the X server in your host prior
|
||||||
|
# to running `docker compose up`. Run `xhost local:docker` in the host to allow
|
||||||
|
# for those connections, otherwise the following error will occur:
|
||||||
|
# Gtk-WARNING **: cannot open display: :0
|
||||||
|
# See https://stackoverflow.com/a/34586732/8401696 for more context.
|
||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
build: .
|
build:
|
||||||
|
context: ../../..
|
||||||
|
dockerfile: ./frontend/scripts/docker-buildfiles/Dockerfile
|
||||||
image: appflowy/appflowy:latest
|
image: appflowy/appflowy:latest
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
# tty: true
|
# tty: true
|
||||||
devices:
|
devices:
|
||||||
- "/dev/dri:/dev/dri" # fixes MESA-LOADER error
|
- /dev/dri:/dev/dri # fixes MESA-LOADER error
|
||||||
environment:
|
environment:
|
||||||
- DISPLAY=${DISPLAY}
|
- DISPLAY=$DISPLAY
|
||||||
- NO_AT_BRIDGE=1 # fixes dbind-WARNING
|
- NO_AT_BRIDGE=1 # fixes dbind-WARNING
|
||||||
volumes:
|
volumes:
|
||||||
- $HOME/.Xauthority:/root/.Xauthority:rw
|
- $HOME/.Xauthority:/root/.Xauthority:rw
|
||||||
- /tmp/.X11-unix:/tmp/.X11-unix
|
- /tmp/.X11-unix:/tmp/.X11-unix
|
||||||
- /dev/dri:/dev/dri
|
- /dev/dri:/dev/dri
|
||||||
- /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket
|
- /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket
|
||||||
- appflowy-data:/home/makepkg
|
|
||||||
network_mode: host
|
network_mode: host
|
||||||
|
|
||||||
volumes:
|
|
||||||
appflowy-data:
|
|
||||||
|
Loading…
Reference in New Issue
Block a user