-
Notifications
You must be signed in to change notification settings - Fork 4
Allow switching category automatically to make torrents linked #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dioxus-switch
Are you sure you want to change the base?
Changes from all commits
83555dd
2a7927e
f148463
f29407c
24b3259
d00500c
e170b52
616c707
271f841
6096f2a
f4688e3
888baa3
6c6fd36
ff9e171
bae6ba5
ba6a041
2856baa
c0a1c78
a1137f4
e9ac197
e11c2fa
615e4ae
9b626d9
7ba8973
c39b275
63c672c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| .git | ||
| .github | ||
| .agents | ||
|
|
||
| target | ||
| node_modules | ||
| test-results | ||
|
|
||
| data.db | ||
| *.db | ||
| *.sqlite | ||
| *.sqlite3 | ||
|
|
||
| .DS_Store | ||
|
|
||
| config.toml | ||
| finn.json | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,76 +1,41 @@ | ||
| # syntax=docker/dockerfile:1.3-labs | ||
| # syntax=docker/dockerfile:1.7-labs | ||
|
|
||
| # The above line is so we can use can use heredocs in Dockerfiles. No more && and \! | ||
| # https://www.docker.com/blog/introduction-to-heredocs-in-dockerfiles/ | ||
|
|
||
| FROM rust:1.91 AS build | ||
|
|
||
| RUN <<EOF | ||
| set -e | ||
| cargo new --lib app/mlm_db | ||
| cargo new --lib app/mlm_mam | ||
| cargo new --lib app/mlm_parse | ||
| cargo new --lib app/mlm_meta | ||
| cargo new --lib app/mlm_core | ||
| cargo new --lib app/mlm_web_askama | ||
| cargo new --bin app/mlm_web_dioxus | ||
| cargo new --bin app/server | ||
| touch /app/mlm_web_dioxus/src/lib.rs | ||
| EOF | ||
|
|
||
| # Capture dependencies | ||
| COPY Cargo.toml Cargo.lock /app/ | ||
| COPY mlm_db/Cargo.toml /app/mlm_db/ | ||
| COPY mlm_mam/Cargo.toml /app/mlm_mam/ | ||
| COPY mlm_parse/Cargo.toml /app/mlm_parse/ | ||
| COPY mlm_meta/Cargo.toml /app/mlm_meta/ | ||
| COPY mlm_core/Cargo.toml /app/mlm_core/ | ||
| COPY mlm_web_askama/Cargo.toml /app/mlm_web_askama/ | ||
| COPY mlm_web_dioxus/Cargo.toml /app/mlm_web_dioxus/ | ||
| COPY server/Cargo.toml /app/server/ | ||
|
|
||
| # This step compiles only our dependencies and saves them in a layer. This is the most impactful time savings | ||
| # Note the use of --mount=type=cache. On subsequent runs, we'll have the crates already downloaded | ||
| FROM rust:1.91 AS chef | ||
| RUN apt update && apt install -y clang mold pkg-config && apt clean | ||
| RUN cargo install cargo-chef --locked | ||
| WORKDIR /app | ||
| RUN --mount=type=cache,target=/usr/local/cargo/registry cargo build --release | ||
|
|
||
| # Copy our sources | ||
| COPY ./mlm_db /app/mlm_db | ||
| COPY ./mlm_mam /app/mlm_mam | ||
| COPY ./mlm_parse /app/mlm_parse | ||
| COPY ./mlm_meta /app/mlm_meta | ||
| COPY ./mlm_core /app/mlm_core | ||
| COPY ./mlm_web_askama /app/mlm_web_askama | ||
| COPY ./mlm_web_dioxus /app/mlm_web_dioxus | ||
| COPY ./server /app/server | ||
|
|
||
| # A bit of magic here! | ||
| # * We're mounting that cache again to use during the build, otherwise it's not present and we'll have to download those again - bad! | ||
| # * EOF syntax is neat but not without its drawbacks. We need to `set -e`, otherwise a failing command is going to continue on | ||
| # * Rust here is a bit fiddly, so we'll touch the files (even though we copied over them) to force a new build | ||
| RUN --mount=type=cache,target=/usr/local/cargo/registry <<EOF | ||
| set -e | ||
| # update timestamps to force a new build | ||
| touch /app/mlm_db/src/lib.rs | ||
| touch /app/mlm_mam/src/lib.rs | ||
| touch /app/mlm_parse/src/lib.rs | ||
| touch /app/mlm_meta/src/lib.rs | ||
| touch /app/mlm_core/src/lib.rs | ||
| touch /app/mlm_web_askama/src/lib.rs | ||
| touch /app/mlm_web_dioxus/src/lib.rs | ||
| touch /app/mlm_web_dioxus/src/main.rs | ||
| touch /app/server/src/main.rs | ||
| cargo build --release | ||
| EOF | ||
|
|
||
| CMD ["/app/target/release/mlm"] | ||
| FROM chef AS planner | ||
| COPY . . | ||
| RUN cargo chef prepare --recipe-path recipe.json | ||
|
|
||
| FROM chef AS builder | ||
| COPY --from=planner /app/recipe.json recipe.json | ||
| RUN --mount=type=cache,target=/usr/local/cargo/registry \ | ||
| --mount=type=cache,target=/usr/local/cargo/git \ | ||
| --mount=type=cache,target=/app/target \ | ||
| cargo chef cook --release --recipe-path recipe.json | ||
|
|
||
| COPY . . | ||
| RUN --mount=type=cache,target=/usr/local/cargo/registry \ | ||
| --mount=type=cache,target=/usr/local/cargo/git \ | ||
| --mount=type=cache,target=/app/target \ | ||
| cargo build --release | ||
| RUN --mount=type=cache,target=/usr/local/cargo/registry \ | ||
| --mount=type=cache,target=/usr/local/cargo/git \ | ||
| cargo install dioxus-cli --version 0.7.3 --locked | ||
| RUN --mount=type=cache,target=/usr/local/cargo/registry \ | ||
| --mount=type=cache,target=/usr/local/cargo/git \ | ||
| --mount=type=cache,target=/app/target \ | ||
| cd /app/mlm_web_dioxus && dx build --release --fullstack --skip-assets | ||
|
|
||
| # Again, our final image is the same - a slim base and just our app | ||
| FROM debian:trixie-slim AS app | ||
| RUN apt update && apt install -y ca-certificates && apt clean | ||
| COPY ./server/assets /server/assets | ||
| COPY --from=build /app/target/release/mlm /mlm | ||
| COPY --from=builder /app/target/release/mlm /mlm | ||
| COPY --from=builder /app/target/dx/mlm_web_dioxus/release/web/public /dioxus-public | ||
| ENV MLM_LOG_DIR="" | ||
| ENV MLM_CONFIG_FILE="/config/config.toml" | ||
| ENV MLM_DB_FILE="/data/data.db" | ||
| ENV DIOXUS_PUBLIC_PATH="/dioxus-public" | ||
| CMD ["/mlm"] | ||
|
Comment on lines
32
to
41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Run the runtime image as a non-root user. The final stage never switches away from root, so any compromise in 🧰 Tools🪛 Checkov (3.2.508)[low] 1-41: Ensure that HEALTHCHECK instructions have been added to container images (CKV_DOCKER_2) [low] 1-41: Ensure that a user for the container has been created (CKV_DOCKER_3) 🪛 Hadolint (2.14.0)[info] 33-33: Delete the apt lists (/var/lib/apt/lists) after installing something (DL3009) [warning] 33-33: Do not use apt as it is meant to be an end-user tool, use apt-get or apt-cache instead (DL3027) 🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Consider adding
.envfiles to the exclusions.The current exclusions look comprehensive. If the project uses
.envfiles for secrets or local configuration, consider adding them to prevent accidental inclusion in the Docker build context:📝 Committable suggestion
🤖 Prompt for AI Agents