terhechte / Ebou

A cross platform Mastodon Client written in Rust
https://terhech.de/ebou/
GNU General Public License v3.0
542 stars 33 forks source link

A dockefile or compose setup ? #4

Open Tobi-De opened 1 year ago

Tobi-De commented 1 year ago

I attempted this on Linux, but the build failed. Since I'm not very familiar with Rust and I'm concerned about potentially disrupting my system dependencies, I would like to explore the possibility of setting up a Dockerfile. This would make the setup process easier on any system. I will conduct some research to see if I can find a suitable solution and submit a pull request to the repository if I discover one.

terhechte commented 1 year ago

Thanks @Tobi-De!

You might also wanna check the required dependencies as can be seen here: https://github.com/terhechte/Ebou/issues/1

Would be supercool if you could provide a PR that adds a working Dockerfile :) Thanks!

Tobi-De commented 1 year ago

Thanks @Tobi-De!

You might also wanna check the required dependencies as can be seen here: #1

Would be supercool if you could provide a PR that adds a working Dockerfile :) Thanks!

I've started something, it's very basic and chatgpt has done most of the work.

FROM  ekidd/rust-musl-builder:stable

# Install system dependencies
RUN sudo apt-get update && \
    sudo apt-get install -y \
    libgtk-3-dev \
    libsoup2.4-dev \
    libwebkit2gtk-4.0-dev

# Set the working directory
WORKDIR /app

# Copy the project files to the container
COPY . .

# Build the project
RUN cargo build --release

# Set the entrypoint to run the project
CMD ["cargo", "run", "--release"]

I'm getting errors related to dependencies

 => ERROR [5/5] RUN cargo build --release                                                                       318.6s
------
 > [5/5] RUN cargo build --release:
#0 1.057     Updating crates.io index
#0 306.1     Updating git repository `https://github.com/terhechte/dioxus.git`
#0 312.9     Updating git repository `https://github.com/terhechte/navicula`
#0 314.2     Updating git repository `https://github.com/terhechte/cacao`
#0 315.7     Updating git repository `https://github.com/terhechte/megalodon-rs`
#0 317.1     Updating git repository `https://github.com/terhechte/muda.git`
#0 318.4 error: failed to select a version for the requirement `env_logger = "^0.10.0"`
#0 318.4 candidate versions found which didn't match: 0.9.3, 0.9.2, 0.9.1, ...
#0 318.4 location searched: crates.io index
#0 318.4 required by package `ebou v0.2.0 (/app)`
------
Dockerfile:20
--------------------
  18 |     
  19 |     # Build the project
  20 | >>> RUN cargo build --release
  21 |     
  22 |     # Set the entrypoint to run the project
--------------------
ERROR: failed to solve: process "/bin/sh -c cargo build --release" did not complete successfully: exit code: 101

any idea of what is going on @terhechte ?

terhechte commented 1 year ago

Now that @cantudo his PR has been merged, building for Linux in a docker file should also work. Can you try again but with the following apt command?

sudo apt-get update && sudo apt-get install pkg-config libssl-dev libgtk-3-dev xdotool libxdo-dev libwebkit2gtk-4.1-dev libgtk-3-0 libgtk-3-dev

That should include all required dependencies.

Tobi-De commented 1 year ago

Now that @cantudo his PR has been merged, building for Linux in a docker file should also work. Can you try again but with the following apt command?

sudo apt-get update && sudo apt-get install pkg-config libssl-dev libgtk-3-dev xdotool libxdo-dev libwebkit2gtk-4.1-dev libgtk-3-0 libgtk-3-dev

That should include all required dependencies.

same issue

------
 > [5/5] RUN cargo build --release:
#0 1.562     Updating crates.io index
#0 317.6     Updating git repository `https://github.com/terhechte/dioxus.git`
#0 332.3     Updating git repository `https://github.com/terhechte/navicula`
#0 334.2     Updating git repository `https://github.com/terhechte/megalodon-rs`
#0 336.8     Updating git repository `https://github.com/terhechte/cacao`
#0 340.2 error: failed to select a version for the requirement `env_logger = "^0.10.0"`
#0 340.2 candidate versions found which didn't match: 0.9.3, 0.9.2, 0.9.1, ...
#0 340.2 location searched: crates.io index
#0 340.2 required by package `ebou v0.2.0 (/app)`
------
Dockerfile:22

It seems there is a dependency issue with the package env_logger, the version in Cargo.toml file cannot be found

StandingPadAnimations commented 1 year ago

I attempted this on Linux, but the build failed. Since I'm not very familiar with Rust and I'm concerned about potentially disrupting my system dependencies, I would like to explore the possibility of setting up a Dockerfile.

Rust doesn't mess with system dependencies, it stores everything locally (in the target folder). That being said, can you try again today (env_logger doesn't seem to be a dependency anymore)? I've built Ebou again a couple of minutes ago to test and update the AUR package and it works on my system, so it should work in Docker as well.

Tobi-De commented 1 year ago

I attempted this on Linux, but the build failed. Since I'm not very familiar with Rust and I'm concerned about potentially disrupting my system dependencies, I would like to explore the possibility of setting up a Dockerfile.

Rust doesn't mess with system dependencies, it stores everything locally (in the target folder). That being said, can you try again today (env_logger doesn't seem to be a dependency anymore)? I've built Ebou again a couple of minutes ago to test and update the AUR package and it works on my system, so it should work in Docker as well.

Same issue, env_logger still cause the build to fail

terhechte commented 1 year ago

My current guess is that it's somehow related to musl (ekidd/rust-musl-builder:stable). I'll try with a minimal ubuntu docker file today to see if that helps