Skip to content

Commit

Permalink
init docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
Klaven committed Apr 28, 2024
1 parent 4bf07c6 commit ef3a835
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 33 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build-backend-container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: build-twitch-alerts

on:
push:
branches:
- 'main'
workflow_dispatch:

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push API
uses: docker/build-push-action@v4
with:
context: ./
push: true
tags: nullchannel/twitch-alerts:${{ github.sha }}
42 changes: 42 additions & 0 deletions .github/workflows/build-ui-container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: build-twitch-alerts

on:
push:
branches:
- 'main'
workflow_dispatch:

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Install Trunk
run: cargo install --locked trunk
-
name: Build UI
run: |
cd frontend/wasm
trunk build --release
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push API
uses: docker/build-push-action@v4
with:
context: ./frontend/wasm/
push: true
tags: nullchannel/twitch-alerts:${{ github.sha }}
41 changes: 41 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[workspace]


members = [
"ai_manager_service",
"twitch_listener_service",
Expand All @@ -12,10 +13,50 @@ members = [
"twitch_chat", "light_server",
]

resolver = "2"

exclude = [
"twitch_api"
]

[workspace.dependencies]
anyhow = "1.0"
sqlx = { version = "0.7.1", features = ["sqlite", "runtime-tokio-native-tls"] }
structopt = "0.3"
twitch_api = { git = "https://github.com/twitch-rs/twitch_api.git", features = [
"reqwest",
"helix",
"eventsub",
"hmac",
"unsupported",
"mock_api"] }

clap = { version = "4.1.8", features = ["derive", "env"] }
color-eyre = { version = "0.6", features = ["capture-spantrace"] }
dotenvy = "0.15.6"
eyre = { version = "0.6" }
futures = "0.3.26"
hyper = "0.14"
reqwest = { version = "0.12.4", features = ["json"] }
retainer = "0.3.0"
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1" }
tokio = { version = "1.26.0", features = ["macros", "rt-multi-thread"] }
tokio-tungstenite = { version = "0.20.0", features = ["native-tls"] }
tracing = "0.1.37"
tracing-error = "0.2.0"
tracing-log = "0.1.3"
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
url = "2.3.1"
messages = { path = "messages" }
ai_manager_service = { path = "ai_manager_service" }
twitch_listener_service = { path = "twitch_listener_service" }
frontend_api = { path = "frontend_api" }

# trying to fix broken dependencies
twitch_oauth2 = { git = "https://github.com/twitch-rs/twitch_api/" }
twitch_types = { git = "https://github.com/twitch-rs/twitch_api/" }
# workaround for https://github.com/twitch-rs/twitch_api/issues/256
[patch.crates-io.twitch_types]
git = "https://github.com/twitch-rs/twitch_api"
[patch.crates-io.twitch_oauth2]
Expand Down
Binary file modified alerts.db
Binary file not shown.
Binary file removed alerts.db-shm
Binary file not shown.
Binary file removed alerts.db-wal
Binary file not shown.
2 changes: 2 additions & 0 deletions frontend_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ pub type ConnectionMap = Arc<Mutex<HashMap<SocketAddr, Tx>>>;
pub struct FrontendApi {
address: String,
connection_state: ConnectionMap,
message_queue: std::collections::VecDeque<DisplayMessage>,
}

impl FrontendApi {
pub fn new(addr: String) -> FrontendApi {
FrontendApi {
address: addr,
connection_state: ConnectionMap::new(Mutex::new(HashMap::new())),
message_queue: std::collections::VecDeque::new(),
}
}

Expand Down
60 changes: 27 additions & 33 deletions monolith/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,36 @@ edition = "2021"

[dependencies]

anyhow = "1.0"
sqlx = { version = "0.7.1", features = ["sqlite", "runtime-tokio-native-tls"] }
structopt = "0.3"
twitch_api = { git = "https://github.com/twitch-rs/twitch_api.git", features = [
"reqwest",
"helix",
"eventsub",
"hmac",
"unsupported",
"mock_api"] }
anyhow = { workspace = true }
sqlx = { workspace = true }
structopt = { workspace = true }
twitch_api = { workspace = true }

clap = { version = "4.1.8", features = ["derive", "env"] }
color-eyre = { version = "0.6", features = ["capture-spantrace"] }
dotenvy = "0.15.6"
eyre = { version = "0.6" }
futures = "0.3.26"
hyper = "0.14"
reqwest = { version = "0.12.4", features = ["json"] }
retainer = "0.3.0"
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1" }
tokio = { version = "1.26.0", features = ["macros", "rt-multi-thread"] }
tokio-tungstenite = { version = "0.20.0", features = ["native-tls"] }
tracing = "0.1.37"
tracing-error = "0.2.0"
tracing-log = "0.1.3"
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
url = "2.3.1"
messages = { path = "../messages" }
ai_manager_service = { path = "../ai_manager_service" }
twitch_listener_service = { path = "../twitch_listener_service" }
frontend_api = { path = "../frontend_api" }
clap = { workspace = true }
color-eyre = { workspace = true }
dotenvy = { workspace = true }
eyre = { workspace = true }
futures = { workspace = true }
hyper = { workspace = true }
reqwest = { workspace = true }
retainer = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
tokio = { workspace = true }
tokio-tungstenite = { workspace = true }
tracing = { workspace = true }
tracing-error = { workspace = true }
tracing-log = { workspace = true }
tracing-subscriber = { workspace = true }
url = { workspace = true }
messages = { workspace = true }
ai_manager_service = { workspace = true }
twitch_listener_service = { workspace = true }
frontend_api = { workspace = true }

# trying to fix broken dependencies
twitch_oauth2 = { git = "https://github.com/twitch-rs/twitch_api/" }
twitch_types = { git = "https://github.com/twitch-rs/twitch_api/" }
twitch_oauth2 = { workspace = true }
twitch_types = { workspace = true }
# workaround for https://github.com/twitch-rs/twitch_api/issues/256
[patch.crates-io.twitch_types]
git = "https://github.com/twitch-rs/twitch_api"
Expand Down

0 comments on commit ef3a835

Please sign in to comment.