-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2c3433
commit 457b61e
Showing
10 changed files
with
118 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
ARG BASE_IMAGE=rust:1.78.0-slim-buster | ||
|
||
FROM $BASE_IMAGE as planner | ||
WORKDIR /app | ||
RUN cargo install cargo-chef | ||
COPY . . | ||
RUN cargo chef prepare --recipe-path recipe.json | ||
|
||
FROM $BASE_IMAGE as cacher | ||
WORKDIR /app | ||
RUN cargo install cargo-chef \ | ||
&& apt update -y \ | ||
&& apt install pkg-config libssl-dev -y | ||
COPY --from=planner /app/recipe.json recipe.json | ||
RUN cargo chef cook --release --recipe-path recipe.json | ||
|
||
FROM $BASE_IMAGE as builder | ||
WORKDIR /app | ||
COPY . . | ||
RUN apt update -y \ | ||
&& apt install pkg-config libssl-dev -y | ||
# Copy over the cached dependencies | ||
COPY --from=cacher /app/target target | ||
COPY --from=cacher $CARGO_HOME $CARGO_HOME | ||
RUN cargo build --release | ||
|
||
FROM gcr.io/distroless/cc-debian10 | ||
WORKDIR /app | ||
COPY --from=builder /app/target/release/watchvuln-rs . | ||
CMD ["./watchvuln-rs"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
database: | ||
# Database connection URI | ||
uri: {{ get_env(name="DATABASE_URL", default="postgres://postgres:123456@localhost:5432/watchvuln") }} | ||
# When enabled, the sql query will be logged. | ||
enable_logging: false | ||
# Set the timeout duration when acquiring a connection. | ||
connect_timeout: 500 | ||
# Set the idle duration before closing a connection. | ||
idle_timeout: 500 | ||
# Minimum number of connections for a pool. | ||
min_connections: 1 | ||
# Maximum number of connections for a pool. | ||
max_connections: 1 | ||
|
||
task: | ||
# every day 7:00-22:00 interval 30 minute Execute task | ||
cron_config: "0 */1 7-21 * * *" | ||
|
||
# Application logging configuration | ||
logger: | ||
# Enable or disable logging. | ||
enable: true | ||
# Enable pretty backtrace (sets RUST_BACKTRACE=1) | ||
pretty_backtrace: true | ||
# Log level, options: trace, debug, info, warn or error. | ||
level: info | ||
# Define the logging format. options: compact, pretty or Json | ||
format: compact | ||
# By default the logger has filtering only logs that came from your code or logs that came from `loco` framework. to see all third party libraries | ||
# Uncomment the line below to override to see all third party libraries you can enable this config and override the logger filters. | ||
# override_filter: trace | ||
|
||
# Application push message configuration, Now just support tg bot | ||
tg_bot: | ||
chat_id: {{ get_env(name="TG_CHAT_ID", default=0) }} | ||
token: {{ get_env(name="TG_TOKEN", default="") }} | ||
|
||
ding_bot: | ||
access_token: {{ get_env(name="DING_ACCESS_TOKEN", default="") }} | ||
secret_token: {{ get_env(name="DING_SECRET_TOKEN", default="") }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
version: "3" | ||
services: | ||
app: | ||
restart: always | ||
image: fantasticzf/watchvuln-rs:latest | ||
env_file: | ||
- env/app.env | ||
volumes: | ||
- "./config:/app/config" | ||
networks: | ||
- vuln | ||
depends_on: | ||
- db | ||
|
||
db: | ||
image: postgres:15.3-alpine | ||
restart: unless-stopped | ||
# ports: | ||
# - 5432:5432 | ||
networks: | ||
- vuln | ||
volumes: | ||
- "./data:/var/lib/postgresql/data" | ||
env_file: | ||
- env/postgres.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
DATABASE_URL=postgres://watchvuln:watchvuln@db:5432/watchvuln | ||
DING_ACCESS_TOKEN= | ||
DING_SECRET_TOKEN= | ||
TG_CHAT_ID=0 | ||
TG_TOKEN= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
POSTGRES_DB=watchvuln | ||
POSTGRES_USER=watchvuln | ||
POSTGRES_PASSWORD=watchvuln |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters