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

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

3
Cargo.lock generated
View File

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

View File

@ -1,6 +1,6 @@
[package]
name = "route96"
version = "0.2.0"
version = "0.3.0"
edition = "2021"
[[bin]]
@ -20,7 +20,7 @@ media-compression = ["dep:ffmpeg-rs-raw", "dep:libc"]
labels = ["nip96", "dep:candle-core", "dep:candle-nn", "dep:candle-transformers"]
nip96 = ["media-compression"]
blossom = []
bin-void-cat-migrate = ["dep:sqlx-postgres", "dep:clap", "dep:clap_derive"]
bin-void-cat-migrate = ["dep:sqlx-postgres"]
torrent-v2 = []
analytics = []
void-cat-redirects = ["dep:sqlx-postgres"]
@ -43,12 +43,11 @@ chrono = { version = "0.4.38", features = ["serde"] }
url = "2.5.0"
serde_with = { version = "3.8.1", features = ["hex"] }
reqwest = "0.12.8"
clap = { version = "4.5.18", features = ["derive"] }
libc = { version = "0.2.153", 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-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 }
clap = { version = "4.5.18", features = ["derive"], optional = true }
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 FEATURES=labels
ARG FEATURES
FROM $IMAGE as build
WORKDIR /app/src
@ -17,22 +17,22 @@ RUN apt update && \
nasm \
libclang-dev && \
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 && \
./configure \
--prefix=$FFMPEG_DIR \
--prefix=${FFMPEG_DIR} \
--disable-programs \
--disable-doc \
--disable-network \
--enable-gpl \
--enable-version3 \
--enable-libx264 \
--enable-libwebp \
--enable-libvpx \
--disable-static \
--disable-postproc \
--enable-shared && \
make -j8 && make install
RUN cargo install --path . --root /app/build --all-features
make -j$(nproc) install
RUN cargo install --path . --root /app/build --features "${FEATURES}"
FROM node:bookworm as ui_builder
WORKDIR /app/src

View File

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