fix: docker build

This commit is contained in:
kieran 2024-11-12 09:52:32 +00:00
parent 470e82e215
commit 5dfba80357
No known key found for this signature in database
GPG Key ID: DE71CEB3925BE941
5 changed files with 22 additions and 15 deletions

View File

@ -4,4 +4,5 @@ data/
Dockerfile Dockerfile
docker-compose.yml docker-compose.yml
.dockerignore .dockerignore
.gitignore .gitignore
ui_src/.node_modules

3
Cargo.lock generated
View File

@ -2975,7 +2975,7 @@ dependencies = [
[[package]] [[package]]
name = "route96" name = "route96"
version = "0.2.0" version = "0.3.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"base64 0.22.1", "base64 0.22.1",
@ -2984,7 +2984,6 @@ dependencies = [
"candle-transformers", "candle-transformers",
"chrono", "chrono",
"clap", "clap",
"clap_derive",
"config", "config",
"ffmpeg-rs-raw", "ffmpeg-rs-raw",
"hex", "hex",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "route96" name = "route96"
version = "0.2.0" version = "0.3.0"
edition = "2021" edition = "2021"
[[bin]] [[bin]]
@ -20,7 +20,7 @@ media-compression = ["dep:ffmpeg-rs-raw", "dep:libc"]
labels = ["nip96", "dep:candle-core", "dep:candle-nn", "dep:candle-transformers"] labels = ["nip96", "dep:candle-core", "dep:candle-nn", "dep:candle-transformers"]
nip96 = ["media-compression"] nip96 = ["media-compression"]
blossom = [] blossom = []
bin-void-cat-migrate = ["dep:sqlx-postgres", "dep:clap", "dep:clap_derive"] bin-void-cat-migrate = ["dep:sqlx-postgres"]
torrent-v2 = [] torrent-v2 = []
analytics = [] analytics = []
void-cat-redirects = ["dep:sqlx-postgres"] void-cat-redirects = ["dep:sqlx-postgres"]
@ -43,12 +43,11 @@ chrono = { version = "0.4.38", features = ["serde"] }
url = "2.5.0" url = "2.5.0"
serde_with = { version = "3.8.1", features = ["hex"] } serde_with = { version = "3.8.1", features = ["hex"] }
reqwest = "0.12.8" reqwest = "0.12.8"
clap = { version = "4.5.18", features = ["derive"] }
libc = { version = "0.2.153", optional = true } libc = { version = "0.2.153", optional = true }
ffmpeg-rs-raw = { git = "https://git.v0l.io/Kieran/ffmpeg-rs-raw.git", rev = "363ad4f55ce3b7047d13197bdff6ed9bd059c099", optional = true} ffmpeg-rs-raw = { git = "https://git.v0l.io/Kieran/ffmpeg-rs-raw.git", rev = "363ad4f55ce3b7047d13197bdff6ed9bd059c099", optional = true }
candle-core = { git = "https://git.v0l.io/Kieran/candle.git", version = "^0.7.2", optional = true } candle-core = { git = "https://git.v0l.io/Kieran/candle.git", version = "^0.7.2", optional = true }
candle-nn = { git = "https://git.v0l.io/Kieran/candle.git", version = "^0.7.2", optional = true } candle-nn = { git = "https://git.v0l.io/Kieran/candle.git", version = "^0.7.2", optional = true }
candle-transformers = { git = "https://git.v0l.io/Kieran/candle.git", version = "^0.7.2", optional = true } candle-transformers = { git = "https://git.v0l.io/Kieran/candle.git", version = "^0.7.2", optional = true }
clap = { version = "4.5.18", features = ["derive"], optional = true }
sqlx-postgres = { version = "0.8.2", optional = true, features = ["chrono", "uuid"] } sqlx-postgres = { version = "0.8.2", optional = true, features = ["chrono", "uuid"] }
clap_derive = { version = "4.5.18", optional = true }

View File

@ -1,5 +1,5 @@
ARG IMAGE=rust:bookworm ARG IMAGE=rust:bookworm
ARG FEATURES=labels ARG FEATURES
FROM $IMAGE as build FROM $IMAGE as build
WORKDIR /app/src WORKDIR /app/src
@ -17,22 +17,22 @@ RUN apt update && \
nasm \ nasm \
libclang-dev && \ libclang-dev && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
RUN git clone --depth=1 https://git.v0l.io/Kieran/FFmpeg.git && \ RUN git clone --single-branch --branch release/7.1 https://git.v0l.io/ffmpeg/FFmpeg.git && \
cd FFmpeg && \ cd FFmpeg && \
./configure \ ./configure \
--prefix=$FFMPEG_DIR \ --prefix=${FFMPEG_DIR} \
--disable-programs \ --disable-programs \
--disable-doc \ --disable-doc \
--disable-network \ --disable-network \
--enable-gpl \ --enable-gpl \
--enable-version3 \
--enable-libx264 \ --enable-libx264 \
--enable-libwebp \ --enable-libwebp \
--enable-libvpx \ --enable-libvpx \
--disable-static \ --disable-static \
--disable-postproc \
--enable-shared && \ --enable-shared && \
make -j8 && make install make -j$(nproc) install
RUN cargo install --path . --root /app/build --all-features RUN cargo install --path . --root /app/build --features "${FEATURES}"
FROM node:bookworm as ui_builder FROM node:bookworm as ui_builder
WORKDIR /app/src WORKDIR /app/src

View File

@ -1,6 +1,7 @@
use std::net::{IpAddr, SocketAddr}; use std::net::{IpAddr, SocketAddr};
use anyhow::Error; use anyhow::Error;
use clap::Parser;
use config::Config; use config::Config;
use log::{error, info}; use log::{error, info};
use rocket::config::Ident; use rocket::config::Ident;
@ -21,6 +22,11 @@ use route96::settings::Settings;
use route96::void_db::VoidCatDb; use route96::void_db::VoidCatDb;
use route96::webhook::Webhook; use route96::webhook::Webhook;
#[derive(Parser, Debug)]
#[command(version, about)]
struct Args {
}
#[rocket::main] #[rocket::main]
async fn main() -> Result<(), Error> { async fn main() -> Result<(), Error> {
pretty_env_logger::init(); pretty_env_logger::init();
@ -34,12 +40,14 @@ async fn main() -> Result<(), Error> {
let db = Database::new(&settings.database).await?; let db = Database::new(&settings.database).await?;
let _args: Args = Args::parse();
info!("Running DB migration"); info!("Running DB migration");
db.migrate().await?; db.migrate().await?;
let mut config = rocket::Config::default(); let mut config = rocket::Config::default();
let ip: SocketAddr = match &settings.listen { let ip: SocketAddr = match &settings.listen {
Some(i) => i.parse().unwrap(), Some(i) => i.parse()?,
None => SocketAddr::new(IpAddr::from([0, 0, 0, 0]), 8000), None => SocketAddr::new(IpAddr::from([0, 0, 0, 0]), 8000),
}; };
config.address = ip.ip(); config.address = ip.ip();