Compare commits
2 Commits
1ebccef389
...
bfbf9adf53
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bfbf9adf53 | ||
|
|
60cd6097e4 |
30
Dockerfile
30
Dockerfile
@@ -1,4 +1,28 @@
|
||||
FROM ubuntu:latest
|
||||
LABEL authors="YE"
|
||||
FROM rust:1.80-slim AS builder
|
||||
|
||||
ENTRYPOINT ["top", "-b"]
|
||||
# Dummy app
|
||||
RUN USER=root cargo new --bin app
|
||||
WORKDIR /app
|
||||
|
||||
# Cargo build and src cleaup
|
||||
COPY ./Cargo.toml ./Cargo.toml
|
||||
COPY ./Cargo.lock ./Cargo.lock
|
||||
RUN cargo build --release
|
||||
RUN rm src/*.rs
|
||||
|
||||
# Copy src files
|
||||
COPY ./src ./src
|
||||
RUN rm ./target/release/deps/app*
|
||||
RUN cargo build --release
|
||||
|
||||
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
# Install necessary runtime libraries
|
||||
RUN apt-get update && apt-get install -y libssl-dev ca-certificates && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy the binary from the builder stage
|
||||
COPY --from=builder /app/target/release/app /usr/local/bin/app
|
||||
|
||||
# Set execution permissions and run
|
||||
CMD ["app"]
|
||||
@@ -1,8 +1,5 @@
|
||||
use crate::{config, models};
|
||||
|
||||
pub struct FeishuClient {
|
||||
pub client: open_lark::prelude::LarkClient,
|
||||
}
|
||||
use crate::models::feishu::FeishuClient;
|
||||
|
||||
impl FeishuClient {
|
||||
pub fn new() -> Result<Self, Box<dyn std::error::Error>> {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use crate::api;
|
||||
use crate::config;
|
||||
use crate::models;
|
||||
use std::error::Error;
|
||||
use crate::config::Config;
|
||||
|
||||
pub async fn summarize_rss() -> Result<Vec<models::summary::Summary>, Box<dyn Error>> {
|
||||
let config = config::Config::build()?;
|
||||
let config = Config::build()?;
|
||||
|
||||
let mut summary_list: Vec<models::summary::Summary> = Vec::new();
|
||||
let token = &config.token;
|
||||
|
||||
@@ -6,7 +6,7 @@ mod models;
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let summary_list = controls::summary::summarize_rss().await?;
|
||||
let app = controls::feishu::FeishuClient::new()?;
|
||||
let app = models::feishu::FeishuClient::new()?;
|
||||
|
||||
for summary in summary_list {
|
||||
app.send_message(&summary.name).await?;
|
||||
|
||||
@@ -2,3 +2,7 @@
|
||||
pub struct MessageContent {
|
||||
pub text: String,
|
||||
}
|
||||
|
||||
pub struct FeishuClient {
|
||||
pub client: open_lark::prelude::LarkClient,
|
||||
}
|
||||
Reference in New Issue
Block a user