armature-framework 0.3.0

A modern, type-safe HTTP framework for Rust inspired by Angular and NestJS. Features dependency injection, decorators, middleware, authentication (JWT/OAuth2/SAML), validation, OpenAPI/Swagger, caching, job queues, and observability.
# =============================================================================
# Armature Google Cloud Run - Cloud Build Optimized
# =============================================================================
# Optimized for Google Cloud Build with caching
# =============================================================================

# -----------------------------------------------------------------------------
# Stage 1: Builder
# -----------------------------------------------------------------------------
FROM rust:1.94-alpine AS builder

# Name of the compiled binary (your crate's [[bin]] name, usually the
# package name). Override with: docker build --build-arg BIN_NAME=my-app
ARG BIN_NAME=app

WORKDIR /app

# Install build dependencies
RUN apk add --no-cache \
    musl-dev \
    openssl-dev \
    openssl-libs-static \
    pkgconfig

# Cache dependencies
COPY Cargo.toml Cargo.lock* ./
RUN mkdir src && echo "fn main() {}" > src/main.rs
RUN cargo build --release --target x86_64-unknown-linux-musl || true
RUN rm -rf src

# Build application
COPY src ./src
RUN cargo build --release --target x86_64-unknown-linux-musl --bin ${BIN_NAME}

# -----------------------------------------------------------------------------
# Stage 2: Runtime
# -----------------------------------------------------------------------------
FROM gcr.io/distroless/static-debian12:nonroot

# Redeclare: ARGs do not cross FROM boundaries
ARG BIN_NAME=app

WORKDIR /app

COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/${BIN_NAME} /app/server

ENV PORT=8080
EXPOSE 8080

USER nonroot:nonroot

ENTRYPOINT ["/app/server"]