From 812d4aa58090829629f3ca691e574ba6d8e8ea3d Mon Sep 17 00:00:00 2001 From: thebigG Date: Mon, 19 Jun 2023 15:07:40 -0500 Subject: [PATCH 1/3] -Add Dockerfile --- Dockerfile | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..395a49e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +#bookworm refers to the debian version +FROM rust:bookworm + +RUN apt update && \ + apt-get -y install clang && \ + apt-get -y install libclang-dev && \ + apt-get install -y sudo && \ + apt-get install -y libgtk-4-dev && \ + apt-get install -y libadwaita-1-0 && \ + apt-get install -y meson && \ + apt-get install -y ninja-build && \ + apt-get install -y git && \ + apt-get install -y valac && \ + apt-get install -y gettext + +RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers + +RUN useradd -ms /bin/bash -G sudo lemoa +USER lemoa +WORKDIR /home/lemoa +RUN git clone --recursive https://gitlab.gnome.org/GNOME/libadwaita.git +RUN cd /home/lemoa/libadwaita && git checkout 1.2.0 +RUN cd /home/lemoa/libadwaita && sudo meson . _build +RUN cd /home/lemoa/libadwaita && sudo ninja -C _build +RUN cd /home/lemoa/libadwaita && sudo ninja -C _build install + +RUN mkdir lemoa_volume + +#COPY --chown=lemoa:lemoa . /home/lemoa/lemoa +#RUN rustup component add rustfmt +#RUN rustfmt --check /home/lemoa/lemoa +#These might be useful for wasm deployments in the future. +#RUN rustup target add wasm32-unknown-unknown + +#CMD cd /home/lemoa/lemoa && cargo build From ef0c99db0b9f42f585302fa569a79ac690d16201 Mon Sep 17 00:00:00 2001 From: thebigG Date: Mon, 19 Jun 2023 15:14:55 -0500 Subject: [PATCH 2/3] -Update README --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index f6310f1..5ffe95c 100644 --- a/README.md +++ b/README.md @@ -38,5 +38,16 @@ Clone the repository and run cargo run ``` +# Build inside Docker +Be sure you to replace `$PATH_TO_REPO` with the path to this cloned repo on your filesystem. +``` +sudo docker build --no-cache . -t lemoa:latest +sudo docker run -v $PATH_TO_REPO:/home/lemoa/lemoa_volume -it lemoa:latest bash +cd lemoa_volume/ +cargo build +``` +The binary will also be available on your host system since $PATH_TO_REPO is mounted as a shared volume between docker and host. + + # License Lemoa is licensed under the [**GNU General Public License**](https://www.gnu.org/licenses/gpl.html): You can use, study and share it as you want. From 6ef57d3c9f96a3ce48905cde3c851aa4c1dc0b9e Mon Sep 17 00:00:00 2001 From: Bnyro Date: Tue, 20 Jun 2023 11:09:12 +0200 Subject: [PATCH 3/3] Switch Dockerfile to using void linux for better compile times --- Dockerfile | 39 +++++++++++++++------------------------ README.md | 11 ++++------- 2 files changed, 19 insertions(+), 31 deletions(-) diff --git a/Dockerfile b/Dockerfile index 395a49e..720a21d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,30 +1,21 @@ #bookworm refers to the debian version -FROM rust:bookworm +FROM voidlinux/voidlinux -RUN apt update && \ - apt-get -y install clang && \ - apt-get -y install libclang-dev && \ - apt-get install -y sudo && \ - apt-get install -y libgtk-4-dev && \ - apt-get install -y libadwaita-1-0 && \ - apt-get install -y meson && \ - apt-get install -y ninja-build && \ - apt-get install -y git && \ - apt-get install -y valac && \ - apt-get install -y gettext +RUN xbps-install -Syu xbps +RUN xbps-install -Syu && \ + xbps-install -y base-devel && \ + xbps-install -y clang && \ + xbps-install -y pkg-config && \ + xbps-install -y gtk4-devel && \ + xbps-install -y libadwaita-devel && \ + xbps-install -y rust && \ + xbps-install -y cargo && \ + xbps-install -y git -RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers - -RUN useradd -ms /bin/bash -G sudo lemoa -USER lemoa -WORKDIR /home/lemoa -RUN git clone --recursive https://gitlab.gnome.org/GNOME/libadwaita.git -RUN cd /home/lemoa/libadwaita && git checkout 1.2.0 -RUN cd /home/lemoa/libadwaita && sudo meson . _build -RUN cd /home/lemoa/libadwaita && sudo ninja -C _build -RUN cd /home/lemoa/libadwaita && sudo ninja -C _build install - -RUN mkdir lemoa_volume +WORKDIR /root +RUN git clone https://github.com/lemmy-gtk/lemoa +RUN cd lemoa && \ + cargo build --release #COPY --chown=lemoa:lemoa . /home/lemoa/lemoa #RUN rustup component add rustfmt diff --git a/README.md b/README.md index 5ffe95c..811b8a9 100644 --- a/README.md +++ b/README.md @@ -38,16 +38,13 @@ Clone the repository and run cargo run ``` -# Build inside Docker -Be sure you to replace `$PATH_TO_REPO` with the path to this cloned repo on your filesystem. +# Building with Docker ``` sudo docker build --no-cache . -t lemoa:latest -sudo docker run -v $PATH_TO_REPO:/home/lemoa/lemoa_volume -it lemoa:latest bash -cd lemoa_volume/ -cargo build +CONTAINER_ID=$(sudo docker create --name lemoa -t lemoa:latest) +sudo docker cp $(CONTAINER_ID):/root/lemoa/target/release/lemoa . ``` -The binary will also be available on your host system since $PATH_TO_REPO is mounted as a shared volume between docker and host. - +Once the build is done, there will be an executable `lemoa` binary file in your current directory, executing it starts Lemoa :tada:. # License Lemoa is licensed under the [**GNU General Public License**](https://www.gnu.org/licenses/gpl.html): You can use, study and share it as you want.