Commit Graph

2070 Commits

Author SHA1 Message Date
Marcello DeSales d98886415b
📝 README: add container support for users without rust/cargo 2023-02-22 19:21:14 -08:00
Marcello DeSales 4fbf5a7802
🐳 Add support for dockerized builds
The initial docker builds takes a while with QEMU, while the built
docker image caches makes building locally very fast. If this is
for the purpose of reuse, one may just pull the latest version
from the docker registry, making it more efficient than just
building from the sources (without having experience with rust/cargo).

Docker builds can be performed as follows:

$ docker buildx build --platform linux/amd64 -t marcellodesales/mdbook -o type=docker  .
[+] Building 2.8s (23/23) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                     0.0s
 => => transferring dockerfile: 2.17kB                                                                                                                                   0.0s
 => [internal] load .dockerignore                                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                                          0.0s
 => [internal] load metadata for docker.io/library/alpine:3.16.0                                                                                                         2.0s
 => [internal] load metadata for docker.io/rustlang/rust:nightly-buster-slim                                                                                             1.4s
 => [auth] library/alpine:pull token for registry-1.docker.io                                                                                                            0.0s
 => [auth] rustlang/rust:pull token for registry-1.docker.io                                                                                                             0.0s
 => [runtime 1/3] FROM docker.io/library/alpine:3.16.0@sha256:686d8c9dfa6f3ccfc8230bc3178d23f84eeaf7e457f36f271ab1acc53015037c                                           0.0s
 => => resolve docker.io/library/alpine:3.16.0@sha256:686d8c9dfa6f3ccfc8230bc3178d23f84eeaf7e457f36f271ab1acc53015037c                                                   0.0s
 => [builder  1/11] FROM docker.io/rustlang/rust:nightly-buster-slim@sha256:609c65daad3c69f9a37717e45d794e2eab99ad488dc5d492b8fc85c97c1df531                             0.0s
 => => resolve docker.io/rustlang/rust:nightly-buster-slim@sha256:609c65daad3c69f9a37717e45d794e2eab99ad488dc5d492b8fc85c97c1df531                                       0.0s
 => [internal] load build context                                                                                                                                        0.0s
 => => transferring context: 4.94kB                                                                                                                                      0.0s
 => CACHED [builder  2/11] RUN apt-get update && apt-get install -y git                                                                                                  0.0s
 => CACHED [builder  3/11] WORKDIR /usr/src/github.com/rust-lang                                                                                                         0.0s
 => CACHED [builder  4/11] RUN USER=root cargo new mdBook                                                                                                                0.0s
 => CACHED [builder  5/11] COPY Cargo.toml Cargo.lock /usr/src/github.com/rust-lang/mdBook                                                                               0.0s
 => CACHED [builder  6/11] COPY examples /usr/src/github.com/rust-lang/mdBook/examples                                                                                   0.0s
 => CACHED [builder  7/11] WORKDIR /usr/src/github.com/rust-lang/mdBook                                                                                                  0.0s
 => CACHED [builder  8/11] RUN rustup target add x86_64-unknown-linux-musl                                                                                               0.0s
 => CACHED [builder  9/11] RUN cargo build -vv --config "net.git-fetch-with-cli=true" --target x86_64-unknown-linux-musl --release                                       0.0s
 => CACHED [builder 10/11] COPY src /usr/src/github.com/rust-lang/mdBook/src                                                                                             0.0s
 => CACHED [builder 11/11] RUN cargo build --locked --bin mdbook --release --target x86_64-unknown-linux-musl                                                            0.0s
 => CACHED [runtime 2/3] COPY --from=builder /usr/src/github.com/rust-lang/mdBook/target/x86_64-unknown-linux-musl/release/mdbook /usr/local/bin/mdbook                  0.0s
 => CACHED [runtime 3/3] RUN echo "I am running on linux/arm64, building for linux/amd64" > /etc/build.log                                                               0.0s
 => exporting to oci image format                                                                                                                                        0.7s
 => => exporting layers                                                                                                                                                  0.0s
 => => exporting manifest sha256:f658cf0db29cb5655960164f745fbd841fb0dbba53f2b387e60c5e23f360459b                                                                        0.0s
 => => exporting config sha256:55c34204ee9e1fea12a11af808615f46f89cb428a3c6ff1e46c1bade9282a26a                                                                          0.0s
 => => sending tarball                                                                                                                                                   0.7s
 => importing to docker

Running the server is a matter of the following:

* Specifying a container to run exposing a given port number
* Specifying the source-code to load mounted as docker volume

At this point, just specifying the current dir of sources with md files
and the local port number the same as the server, here's what we have:

$ ls -la src
total 24
drwxr-xr-x  13 mdesales  staff   416 Feb 22 14:06 .
drwxr-xr-x  12 mdesales  staff   384 Feb 22 14:06 ..
-rw-r--r--   1 mdesales  staff   980 Feb 22 14:06 README.md
-rw-r--r--   1 mdesales  staff  4764 Feb 22 14:06 SUMMARY.md
drwxr-xr-x  10 mdesales  staff   320 Feb 22 14:06 assets
drwxr-xr-x   7 mdesales  staff   224 Feb 22 14:06 data
drwxr-xr-x  19 mdesales  staff   608 Feb 22 14:06 infra
drwxr-xr-x   7 mdesales  staff   224 Feb 22 14:06 monitoring
drwxr-xr-x   7 mdesales  staff   224 Feb 22 14:06 onboard
drwxr-xr-x  17 mdesales  staff   544 Feb 22 14:06 services
drwxr-xr-x   4 mdesales  staff   128 Feb 22 14:06 structure
drwxr-xr-x  43 mdesales  staff  1376 Feb 22 14:06 support
drwxr-xr-x  17 mdesales  staff   544 Feb 22 14:06 tips

$ docker run -ti -v $(pwd)/src:/src -p 3000:3000 marcellodesales/mdbook
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
2023-02-23 03:08:29 [INFO] (mdbook::book): Book building has started
2023-02-23 03:08:29 [INFO] (mdbook::book): Running the html backend
2023-02-23 03:08:34 [INFO] (mdbook::cmd::serve): Serving on: http://0.0.0.0:3000
2023-02-23 03:08:34 [INFO] (warp::server): Server::run; addr=0.0.0.0:3000
2023-02-23 03:08:34 [INFO] (warp::server): listening on http://0.0.0.0:3000
2023-02-23 03:08:34 [INFO] (mdbook::cmd::watch): Listening for changes...

At this point, one may just check the service locally as follows:

$ curl -I http://localhost:3000/
HTTP/1.1 200 OK
content-length: 26343
content-type: text/html
accept-ranges: bytes
last-modified: Thu, 23 Feb 2023 03:08:29 GMT
date: Thu, 23 Feb 2023 03:08:35 GMT

$ curl http://localhost:3000/  | grep mdBook
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0        <!-- Book generated using mdBook -->
100 26343  100 26343    0     0   366k      0 --:--:-- --:--:-- --:--:--  467k
2023-02-22 19:13:44 -08:00
Eric Huss 1668ab7877
Merge pull request #2025 from tshepang/patch-1
Update continuous-integration.md
2023-02-14 06:34:20 -08:00
Tshepang Mbambo 26fc0da9a9
Update continuous-integration.md
typo
2023-02-14 08:29:40 +02:00
Eric Huss c15220d1a1
Merge pull request #2017 from thanatos/roy/fix-sidebar
Default the sidebar to visible in large screens
2023-02-13 12:42:15 -08:00
Eric Huss 7c4562a8b3
Merge pull request #2023 from ehuss/bump-version
Update to 0.4.27
2023-02-13 08:07:35 -08:00
Eric Huss 6e3176f726 Update to 0.4.27 2023-02-13 07:54:28 -08:00
Eric Huss 958b456873
Also make sure releases use --locked
If it somehow gets out of sync, then the release process otherwise wouldn't catch it.
2023-02-13 07:53:32 -08:00
Eric Huss a43b5b69ab
Merge pull request #2022 from ehuss/ci-locked
Make sure CI runs with --locked
2023-02-13 07:51:26 -08:00
Eric Huss 1517435441
Merge pull request #2021 from rust-lang/revert-2009-deps/toml
Revert "bump 'toml' dependency"
2023-02-13 07:44:45 -08:00
Eric Huss 7abb28cb2e Make sure CI runs with --locked 2023-02-13 07:43:46 -08:00
Eric Huss 112fd4aac3
Merge pull request #2020 from mgeisler/patch-1
Remove spammy `debug!` log from `path_to_root`
2023-02-13 07:33:59 -08:00
Eric Huss 90fbe112af
Revert "bump 'toml' dependency" 2023-02-13 07:31:33 -08:00
Martin Geisler c150529c7c
Remove spammy `debug!` log from `path_to_root`
The log statement is empty and simply fills up the logs when you run `mdbook` with `RUST_LOG=debug`.
2023-02-13 16:17:31 +01:00
Roy Wellington Ⅳ fa6aa2ced8 Default the sidebar to visible in large screens
The code here leads me to believe that the intention is for the sidebar
to be default visible on large screens (where `clientWidth` > 1080) and
hidden otherwise.

However, as previously written, if the `localStorage.getItem` call fails
(for example, if the user agent is not accepting cookies), then we fall
back to `sidebar = sidebar || 'visible';` — but `sidebar` is already set
to `hidden`, so the `|| 'visible'` never happens.

This results in the sidebar hiding itself on every navigation through an
mdBook, meaning if you're just switching between sections trying to find
something that you keep needing to re-open the sidebar.
2023-02-11 18:04:58 -05:00
Eric Huss 39664985ba
Merge pull request #2012 from ehuss/bump-version
Update to 0.4.26
2023-02-08 16:09:45 -08:00
Eric Huss ab1e9694bc Update to 0.4.26 2023-02-08 15:58:51 -08:00
Eric Huss 2c710d3b7d
Merge pull request #1987 from ehuss/theme-fonts
Make fonts part of the theme.
2023-02-08 15:56:40 -08:00
Eric Huss 581ab2c945
Merge pull request #2011 from ehuss/update-deps
Update some direct dependencies
2023-02-08 15:53:35 -08:00
Eric Huss 274b48c82f Update some direct dependencies
Updating anyhow v1.0.66 -> v1.0.69
Updating assert_cmd v2.0.7 -> v2.0.8
Updating handlebars v4.3.5 -> v4.3.6
Updating notify v5.0.0 -> v5.1.0
Updating once_cell v1.16.0 -> v1.17.0
Removing bstr v0.2.17
Removing lazy_static v1.4.0
Updating opener v0.5.0 -> v0.5.2
Updating regex v1.7.0 -> v1.7.1
Updating predicates v2.1.4 -> v2.1.5
Updating semver v1.0.14 -> v1.0.16
Updating serde v1.0.150 -> v1.0.152
Updating serde_derive v1.0.150 -> v1.0.152
Updating serde_json v1.0.89 -> v1.0.93
2023-02-08 15:40:48 -08:00
Eric Huss e352e4f59c
Merge pull request #1994 from Skwodo/master
fix overflow-x on mobile
2023-02-08 15:37:53 -08:00
Eric Huss 734936d819 Add some comments about overflow-x 2023-02-08 15:25:14 -08:00
Eric Huss 0e1384b4d2
Merge pull request #2009 from danieleades/deps/toml
bump 'toml' dependency
2023-02-08 14:08:21 -08:00
Daniel Eades 2160613c6a bump 'toml' dependency 2023-02-08 15:40:15 +00:00
Eric Huss 69bb5c7fba
Merge pull request #2001 from iFreilicht/patch-1
Fix incorrect version command
2023-01-29 09:34:13 -08:00
Felix Uhl f32e1a7773
Fix incorrect version command 2023-01-28 20:21:18 +01:00
Eric Huss 703c2f214b
Merge pull request #1998 from dalance/remove_time
Remove dependency to time 0.1.44
2023-01-28 07:41:34 -08:00
dalance 6de831778a Remove dependency to time 0.1.44 2023-01-26 18:02:43 +09:00
Skwodo ca46086e79 fix overflow-x on mobile 2023-01-21 22:41:01 +01:00
Eric Huss 0079184c16
Merge pull request #1961 from noritada/fix/scrollbar-in-chrome-and-safari
Use default scrollbars on webkit browsers
2023-01-18 09:25:02 -08:00
Noritada Kobayashi dcc9efea0a Remove the WebKit-specific scrollbar styling altogether
It is preferable to remove WebKit-specific styling and use the browser
and OS default scrollbars.
Thanks to comments from @julianfortune, @arniu, and @ehuss.

Closes #1483.
2023-01-18 23:51:09 +09:00
Dylan DPC a3b508fab9
Merge pull request #1988 from ehuss/issue-templates
Add issue templates and update contributor docs
2023-01-16 23:00:22 +05:30
Eric Huss 5359b487f2 Add issue templates and update contributor docs 2023-01-16 09:22:54 -08:00
Eric Huss c2d973997a Make fonts part of the theme. 2023-01-15 11:42:46 -08:00
Eric Huss 41a6f0d43e
Merge pull request #1968 from ehuss/ehuss-patch-1
Fix MDBOOK_BOOK environment variable example
2022-12-28 19:47:20 -08:00
Eric Huss 9764f8886b
Fix MDBOOK_BOOK environment variable example 2022-12-28 19:21:38 -08:00
Noritada Kobayashi 1ba2c063e0 Thin scrollbars in Chrome and Safari to make them less assertive (#1483) 2022-12-22 15:40:03 +09:00
Eric Huss c640294dbf
Merge pull request #1960 from ehuss/bump-version
Update to 0.4.25
2022-12-17 08:19:15 -08:00
Eric Huss dec487c62b Update to 0.4.25 2022-12-17 07:42:00 -08:00
Eric Huss 1ba74a30fc
Merge pull request #1959 from ehuss/test-lib-multiple
Fix test with multiple library paths
2022-12-17 07:39:27 -08:00
Eric Huss fcf0cebf6c Fix test with multiple library paths 2022-12-17 07:11:13 -08:00
Eric Huss e14d38194f
Merge pull request #1956 from ehuss/bump-version
Update to 0.4.24
2022-12-15 07:14:13 -08:00
Eric Huss 294aad092e Update to 0.4.24 2022-12-15 06:55:05 -08:00
Eric Huss 8767ebf835
Merge pull request #1955 from ehuss/ubuntu-20.04
Switch to older ubuntu image
2022-12-15 06:50:44 -08:00
Eric Huss cd907f2edf Switch to older ubuntu image 2022-12-15 05:52:15 -08:00
Eric Huss eb77083d23
Merge pull request #1953 from ehuss/bump-version
Update to 0.4.23
2022-12-14 18:46:05 -08:00
Eric Huss 219362318c Update to 0.4.23 2022-12-14 17:48:46 -08:00
Eric Huss 68a75dae48
Merge pull request #1844 from wendajiang/master
Upgrade clap
2022-12-14 17:26:07 -08:00
David 87a381e0a7 upgrade clap to 4.0 2022-12-14 17:11:08 -08:00
Eric Huss 0b2520f84a
Merge pull request #1952 from ehuss/update-deps-breaking
Update dependencies with semver major changes
2022-12-14 17:08:41 -08:00