Update rust (#21)
textsender_auth Build / Rustfmt (push) Successful in 44s
textsender_auth Build / Check (push) Successful in 1m42s
textsender_auth Build / Test Suite (push) Successful in 2m5s
textsender_auth Build / Clippy (push) Successful in 1m38s
textsender_auth Build / build (push) Successful in 3m5s
textsender_auth Build / Rustfmt (push) Successful in 44s
textsender_auth Build / Check (push) Successful in 1m42s
textsender_auth Build / Test Suite (push) Successful in 2m5s
textsender_auth Build / Clippy (push) Successful in 1m38s
textsender_auth Build / build (push) Successful in 3m5s
Reviewed-on: phoenix/textsender_auth#21
This commit was merged in pull request #21.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
name: Rust Build
|
||||
name: pr Build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: 1.96.1
|
||||
toolchain: 1.97
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: |
|
||||
mkdir -p ~/.ssh
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: 1.96.1
|
||||
toolchain: 1.97
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: rustup component add rustfmt
|
||||
- run: |
|
||||
@@ -58,7 +58,7 @@ jobs:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: 1.96.1
|
||||
toolchain: 1.97
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: rustup component add clippy
|
||||
- run: |
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Rust Build
|
||||
name: textsender_auth Build
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: 1.96.1
|
||||
toolchain: 1.97
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: |
|
||||
mkdir -p ~/.ssh
|
||||
@@ -54,7 +54,7 @@ jobs:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: 1.96.1
|
||||
toolchain: 1.97
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
# --- Add this step for explicit verification ---
|
||||
- name: Verify Docker Environment
|
||||
@@ -97,7 +97,7 @@ jobs:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: 1.96.1
|
||||
toolchain: 1.97
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: rustup component add rustfmt
|
||||
- run: |
|
||||
@@ -117,7 +117,7 @@ jobs:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: 1.96.1
|
||||
toolchain: 1.97
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: rustup component add clippy
|
||||
- run: |
|
||||
@@ -137,7 +137,7 @@ jobs:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: 1.96.1
|
||||
toolchain: 1.97
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: |
|
||||
mkdir -p ~/.ssh
|
||||
|
||||
Generated
+34
-26
@@ -185,9 +185,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.12.0"
|
||||
version = "1.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ae3f5d315924270530207e2a68396c3cc547f6dca3fbdca317cfb1a51edb593"
|
||||
checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
@@ -231,6 +231,12 @@ dependencies = [
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "const-oid"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c"
|
||||
|
||||
[[package]]
|
||||
name = "const_format"
|
||||
version = "0.2.36"
|
||||
@@ -391,6 +397,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2"
|
||||
dependencies = [
|
||||
"block-buffer 0.12.1",
|
||||
"const-oid",
|
||||
"crypto-common 0.2.2",
|
||||
"ctutils",
|
||||
]
|
||||
@@ -1012,9 +1019,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.8.2"
|
||||
version = "2.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4"
|
||||
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
|
||||
|
||||
[[package]]
|
||||
name = "mime"
|
||||
@@ -1277,9 +1284,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.12.4"
|
||||
version = "1.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba"
|
||||
checksum = "2a0e75113e14dc5acb068cd0786884f214f1312650a3d36d269f5c4f3cdee8a2"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
@@ -1289,9 +1296,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.14"
|
||||
version = "0.4.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
|
||||
checksum = "1f388202e4b80542a0921078cc23b6333bcf1409c1e3f86404cae4766a6131db"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
@@ -1306,9 +1313,9 @@ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
|
||||
|
||||
[[package]]
|
||||
name = "rust-embed"
|
||||
version = "8.11.0"
|
||||
version = "8.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04113cb9355a377d83f06ef1f0a45b8ab8cd7d8b1288160717d66df5c7988d27"
|
||||
checksum = "e9e7760e252aaba7b09f4be00e36476cf585bdb68a53552ac954cdf504ab4bc9"
|
||||
dependencies = [
|
||||
"rust-embed-impl",
|
||||
"rust-embed-utils",
|
||||
@@ -1317,10 +1324,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rust-embed-impl"
|
||||
version = "8.11.0"
|
||||
version = "8.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da0902e4c7c8e997159ab384e6d0fc91c221375f6894346ae107f47dd0f3ccaa"
|
||||
checksum = "3bcfc4d6f53af43755f7a723e4b6b8794fcce052a178dd8c6c1dadc5f5343097"
|
||||
dependencies = [
|
||||
"mime_guess",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rust-embed-utils",
|
||||
@@ -1330,11 +1338,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rust-embed-utils"
|
||||
version = "8.11.0"
|
||||
version = "8.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5bcdef0be6fe7f6fa333b1073c949729274b05f123a0ad7efcb8efd878e5c3b1"
|
||||
checksum = "42ffa149f6aa81b58a5b3011d01a857c4ed12c7a732d2c51947a4c7c692185f0"
|
||||
dependencies = [
|
||||
"sha2 0.10.9",
|
||||
"sha2 0.11.0",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
@@ -1353,9 +1361,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.22"
|
||||
version = "1.0.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
||||
checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
@@ -1811,7 +1819,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "textsender_auth"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
dependencies = [
|
||||
"argon2",
|
||||
"axum",
|
||||
@@ -1833,8 +1841,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "textsender_models"
|
||||
version = "0.5.1"
|
||||
source = "git+ssh://git@git.kundeng.us/phoenix/textsender_models.git?tag=v0.5.1#151eeaacf64e255bde56a48df03f4c46ec77c235"
|
||||
version = "0.5.2"
|
||||
source = "git+ssh://git@git.kundeng.us/phoenix/textsender_models.git?tag=v0.5.2#02061bf7a380657b7bc76d64d1824388bef8e55a"
|
||||
dependencies = [
|
||||
"const_format",
|
||||
"dotenvy",
|
||||
@@ -1869,9 +1877,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "1.1.9"
|
||||
version = "1.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185"
|
||||
checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
@@ -1918,9 +1926,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tinyvec"
|
||||
version = "1.11.0"
|
||||
version = "1.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3"
|
||||
checksum = "bb4ebadaa0af04fab11ae01eb5f9fdb5f9c5b875506e210e71c07873528baa7f"
|
||||
dependencies = [
|
||||
"tinyvec_macros",
|
||||
]
|
||||
@@ -2412,9 +2420,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zlib-rs"
|
||||
version = "0.6.5"
|
||||
version = "0.6.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5431d5661c32445236631278f27946e444ddafe4684cac70b185272d4f9c52d5"
|
||||
checksum = "b142a20ec14a91d5bc708c1dc21b080c550113d8aa77afa29635673a65dd02c5"
|
||||
|
||||
[[package]]
|
||||
name = "zmij"
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
[package]
|
||||
name = "textsender_auth"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
edition = "2024"
|
||||
rust-version = "1.96.1"
|
||||
rust-version = "1.97"
|
||||
|
||||
[dependencies]
|
||||
axum = { version = "0.8.9" }
|
||||
@@ -12,13 +12,13 @@ tokio = { version = "1.52.3", features = ["rt-multi-thread"] }
|
||||
tracing-subscriber = { version = "0.3.23" }
|
||||
tower-http = { version = "0.7.0", features = ["cors"] }
|
||||
sqlx = { version = "0.9.0", features = ["runtime-tokio", "tls-native-tls", "postgres", "time", "uuid"] }
|
||||
uuid = { version = "1.23.3", features = ["v4", "serde"] }
|
||||
uuid = { version = "1.23.4", features = ["v4", "serde"] }
|
||||
argon2 = { version = "0.5.3", features = ["std"] }
|
||||
time = { version = "0.3.53", features = ["macros", "serde"] }
|
||||
josekit = { version = "0.10.3" }
|
||||
utoipa = { version = "5.5.0", features = ["axum_extras"] }
|
||||
utoipa-swagger-ui = { version = "9.0.2", features = ["axum"] }
|
||||
textsender_models = { git = "ssh://git@git.kundeng.us/phoenix/textsender_models.git", tag = "v0.5.1", features = ["config", "user"] }
|
||||
textsender_models = { git = "ssh://git@git.kundeng.us/phoenix/textsender_models.git", tag = "v0.5.2", features = ["config", "user"] }
|
||||
|
||||
[dev-dependencies]
|
||||
tower = { version = "0.5.3", features = ["full"] }
|
||||
|
||||
+2
-28
@@ -1,14 +1,7 @@
|
||||
# Stage 1: Build the application
|
||||
# Use a specific Rust version for reproducibility. Choose one that matches your development environment.
|
||||
# Using slim variant for smaller base image
|
||||
FROM rust:1.96.1 as builder
|
||||
FROM rust:1.97 as builder
|
||||
|
||||
# Set the working directory inside the container
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Install build dependencies if needed (e.g., for certain crates like sqlx with native TLS)
|
||||
# RUN apt-get update && apt-get install -y pkg-config libssl-dev
|
||||
|
||||
# Install build dependencies if needed (e.g., git for cloning)
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
pkg-config libssl3 \
|
||||
@@ -16,55 +9,36 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
openssh-client git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# << --- ADD HOST KEY HERE --- >>
|
||||
# Replace 'yourgithost.com' with the actual hostname (e.g., github.com)
|
||||
RUN mkdir -p -m 0700 ~/.ssh && \
|
||||
ssh-keyscan git.kundeng.us >> ~/.ssh/known_hosts
|
||||
|
||||
# Copy Cargo manifests
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
|
||||
# Build *only* dependencies to leverage Docker cache
|
||||
# This dummy build caches dependencies as a separate layer
|
||||
RUN --mount=type=ssh mkdir src && \
|
||||
echo "fn main() {println!(\"if you see this, the build broke\")}" > src/main.rs && \
|
||||
cargo build --release --quiet && \
|
||||
rm -rf src target/release/deps/textsender_auth* # Clean up dummy build artifacts
|
||||
rm -rf src target/release/deps/textsender_auth*
|
||||
|
||||
# Copy the actual source code
|
||||
COPY src ./src
|
||||
# If you have other directories like `templates` or `static`, copy them too
|
||||
COPY .env ./.env
|
||||
COPY migrations ./migrations
|
||||
|
||||
# << --- SSH MOUNT ADDED HERE --- >>
|
||||
# Build *only* dependencies to leverage Docker cache
|
||||
# This dummy build caches dependencies as a separate layer
|
||||
# Mount the SSH agent socket for this command
|
||||
RUN --mount=type=ssh \
|
||||
cargo build --release --quiet
|
||||
|
||||
# Stage 2: Create the final, smaller runtime image
|
||||
# Use a minimal base image like debian-slim or even distroless for security/size
|
||||
FROM debian:trixie-slim
|
||||
|
||||
# Install runtime dependencies if needed (e.g., SSL certificates)
|
||||
RUN apt-get update && apt-get install -y ca-certificates libssl-dev libssl3 && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /usr/local/bin
|
||||
|
||||
# Copy the compiled binary from the builder stage
|
||||
COPY --from=builder /usr/src/app/target/release/textsender_auth .
|
||||
|
||||
# Copy other necessary files like .env (if used for runtime config) or static assets
|
||||
# It's generally better to configure via environment variables in Docker though
|
||||
COPY --from=builder /usr/src/app/.env .
|
||||
COPY --from=builder /usr/src/app/migrations ./migrations
|
||||
|
||||
# Expose the port your Axum app listens on (e.g., 3000 or 8000)
|
||||
EXPOSE 9080
|
||||
|
||||
# Set the command to run your application
|
||||
# Ensure this matches the binary name copied above
|
||||
CMD ["./textsender_auth"]
|
||||
|
||||
@@ -1 +1,18 @@
|
||||
# Getting started
|
||||
Quickest way to get started is with docker, make sure that it is installed. Copy over
|
||||
the `.env.docker.sample` file and name it `.env`.
|
||||
|
||||
For `SECRET_KEY` provide a key that is at least 32-characters. This is used for token
|
||||
creation. Additionally, provide credentials for the database for the `DB_*` keys.
|
||||
|
||||
Make sure that `ENABLE_REGISTRATION` is set to true, otherwise registration will not work.
|
||||
|
||||
Build the container
|
||||
```
|
||||
docker compose build
|
||||
```
|
||||
|
||||
Bring up the container
|
||||
```
|
||||
docker compose up
|
||||
```
|
||||
|
||||
+9
-13
@@ -1,28 +1,25 @@
|
||||
version: '3.8' # Use a recent version
|
||||
|
||||
services:
|
||||
# Your Rust Application Service
|
||||
auth_api:
|
||||
build: # Tells docker-compose to build the Dockerfile in the current directory
|
||||
build:
|
||||
context: .
|
||||
ssh: ["default"] # Uses host's SSH agent
|
||||
container_name: textsender_auth # Optional: Give the container a specific name
|
||||
ssh: ["default"]
|
||||
container_name: textsender_auth
|
||||
ports:
|
||||
# Map host port 8000 to container port 3000 (adjust as needed)
|
||||
- "9080:9080"
|
||||
env_file:
|
||||
- .env
|
||||
depends_on:
|
||||
auth_db:
|
||||
condition: service_healthy # Wait for the DB to be healthy before starting the app
|
||||
restart: unless-stopped # Optional: Restart policy
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
|
||||
# PostgreSQL Database Service
|
||||
auth_db:
|
||||
image: postgres:18.4-alpine # Use an official Postgres image (Alpine variant is smaller)
|
||||
container_name: textsender_auth_db # Optional: Give the container a specific name
|
||||
image: postgres:18.4-alpine
|
||||
container_name: textsender_auth_db
|
||||
environment:
|
||||
# These MUST match the user, password, and database name in the DATABASE_URL above
|
||||
POSTGRES_USER: ${DB_AUTH_USER:-textsender_op}
|
||||
POSTGRES_PASSWORD: ${DB_AUTH_PASSWORD:-password}
|
||||
POSTGRES_DB: ${DB_AUTH_NAME:-textsender_auth_db}
|
||||
@@ -38,9 +35,8 @@ services:
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 10s
|
||||
restart: always # Optional: Restart policy
|
||||
restart: always
|
||||
|
||||
# Define the named volume for data persistence
|
||||
volumes:
|
||||
postgres_data:
|
||||
driver: local # Use the default local driver
|
||||
driver: local
|
||||
|
||||
Reference in New Issue
Block a user