Add containerised build instructions

This commit is contained in:
jude 2023-04-09 17:35:40 +01:00
parent ac41dbce0c
commit 34d5fddf6c
4 changed files with 29 additions and 5 deletions

5
Cargo.lock generated
View File

@ -2063,8 +2063,9 @@ dependencies = [
[[package]] [[package]]
name = "songbird" name = "songbird"
version = "0.3.1" version = "0.3.2"
source = "git+https://github.com/Erk-/songbird?branch=do-not-fail-if-new-opcode#0618112a3353a47b2fcdb4eb327ede1a77a8cda2" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32f686a0fd771939de1da3e43cee45169fafe1595770b94680572cf18bdef288"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"async-tungstenite", "async-tungstenite",

View File

@ -7,8 +7,7 @@ authors = ["jellywx <judesouthworth@pm.me>"]
edition = "2018" edition = "2018"
[dependencies] [dependencies]
songbird = { git = "https://github.com/Erk-/songbird", branch = "do-not-fail-if-new-opcode", features = ["builtin-queue"] } songbird = { version = "0.3", features = ["builtin-queue"] }
# songbird = { version = "0.3", features = ["builtin-queue"] }
poise = "0.3" poise = "0.3"
sqlx = { version = "0.5", default-features = false, features = ["runtime-tokio-rustls", "macros", "mysql", "bigdecimal", "migrate"] } sqlx = { version = "0.5", default-features = false, features = ["runtime-tokio-rustls", "macros", "mysql", "bigdecimal", "migrate"] }
tokio = { version = "1", features = ["fs", "process", "io-util"] } tokio = { version = "1", features = ["fs", "process", "io-util"] }

9
Containerfile Normal file
View File

@ -0,0 +1,9 @@
FROM ubuntu:20.04
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
RUN apt update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt install -y gcc gcc-multilib cmake ffmpeg libopus-dev pkg-config libssl-dev curl mysql-client-8.0
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal
RUN cargo install cargo-deb

View File

@ -23,6 +23,12 @@ Options:
## Building from source ## Building from source
When running from source, the config options above can be configured simply as environment variables.
Two options for building are offered. The first is easier.
### Build for local platform
1. Install build dependencies: `sudo apt install gcc gcc-multilib cmake ffmpeg libopus-dev pkg-config libssl-dev` 1. Install build dependencies: `sudo apt install gcc gcc-multilib cmake ffmpeg libopus-dev pkg-config libssl-dev`
2. Install database server: `sudo apt install mysql-server-8.0`. Create a database called `soundfx` 2. Install database server: `sudo apt install mysql-server-8.0`. Create a database called `soundfx`
3. Install Cargo and Rust from https://rustup.rs 3. Install Cargo and Rust from https://rustup.rs
@ -30,4 +36,13 @@ Options:
5. From the source code directory, execute `sqlx migrate run` 5. From the source code directory, execute `sqlx migrate run`
6. Build with cargo: `cargo build --release` 6. Build with cargo: `cargo build --release`
When running from source, the config options above can be configured simply as environment variables. ### Build for other platform
By default, this builds targeting Ubuntu 20.04. Modify the Containerfile if you wish to target a different platform. These instructions are written using `podman`, but `docker` should work too.
1. Install container software: `sudo apt install podman`.
2. Install database server: `sudo apt install mysql-server-8.0`. Create a database called `soundfx`
3. Install SQLx CLI: `cargo install sqlx-cli`
4. From the source code directory, execute `sqlx migrate run`
5. Build container image: `podman build -t soundfx .`
6. Build with podman: `podman run --rm --network=host -v "$PWD":/mnt -w /mnt -e "DATABASE_URL=mysql://user@localhost/soundfx" soundfx cargo deb`