Update build process
This commit is contained in:
1 parent
644adc3f87
commit
7fcb2eb747
8 files changed
+76
-82
No files matched your search
@@ -18,14 +18,26 @@ Recommended method.
|
||||
By default, this builds targeting Ubuntu 20.04. Modify the Containerfile if you wish to target a
|
||||
different platform. These instructions are written using `podman`, but `docker` should work too.
|
||||
|
||||
1. Install container software: `sudo apt install podman`.
|
||||
1. Install container software and Make: `sudo apt install podman make`.
|
||||
2. Install database server: `sudo apt install mysql-server-8.0`. Create a database called
|
||||
`reminders`
|
||||
3. Install SQLx CLI: `cargo install sqlx-cli`
|
||||
4. From the source code directory, execute `sqlx migrate run`
|
||||
5. Build container image: `podman build -t reminder-rs .`
|
||||
6. Build with podman:
|
||||
`podman run --rm --network=host -v "$PWD":/mnt -w /mnt -e "DATABASE_URL=mysql://user@localhost/reminders" reminder-rs cargo deb`
|
||||
3. Install SQLx CLI matching the project's SQLx version: `cargo install sqlx-cli --version 0.8.2 --locked`.
|
||||
4. Install the local build requirements (Rust, Node.js/npm, GCC, CMake, pkg-config, and OpenSSL
|
||||
development headers), then install dashboard dependencies: `npm ci --prefix reminder-dashboard`.
|
||||
5. Export the URL of your build/test database:
|
||||
`export DATABASE_URL="mysql://user[:password]@localhost/reminders"`.
|
||||
6. From the source code directory, execute `sqlx migrate run`.
|
||||
7. Run `make` (or `make build`). This prepares SQLx query metadata in `.sqlx`, runs the Rust tests,
|
||||
builds the `reminder-rs` container image, and runs `cargo deb` inside it. The resulting package is
|
||||
written to `target/debian/`.
|
||||
|
||||
Preparation and database-dependent tests use the local database. The container packaging step uses
|
||||
the prepared `.sqlx` metadata with `SQLX_OFFLINE=true`, so it does not need database access, including
|
||||
when a `.env` file is present in the mounted source directory.
|
||||
|
||||
The stages can also be run separately: `make prepare`, `make test` (includes preparation), and
|
||||
`make image` (includes preparation and tests). Override `IMAGE` to change the container image tag,
|
||||
or `PODMAN` to use another container command, for example `make PODMAN=docker`.
|
||||
|
||||
### Compiling for other target
|
||||
|
||||
|
||||
Reference in new issue
Block a user