mirror of
https://github.com/getnora-io/nora.git
synced 2026-04-12 06:50:31 +00:00
Russian OS registries (registry.astralinux.ru, registry.red-soft.ru) require auth not available in CI. Use scratch base with static musl binary instead — runs on any Linux including Astra SE and RED OS. Comment in each Dockerfile shows how to switch to official base image once registry access is configured.
64 lines
2.0 KiB
Docker
64 lines
2.0 KiB
Docker
# syntax=docker/dockerfile:1.4
|
|
|
|
# Build stage — static binary via musl (runs on any Linux)
|
|
FROM rust:1.83-alpine AS builder
|
|
|
|
RUN apk add --no-cache musl-dev curl
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy manifests
|
|
COPY Cargo.toml Cargo.lock ./
|
|
COPY nora-registry/Cargo.toml nora-registry/
|
|
COPY nora-storage/Cargo.toml nora-storage/
|
|
COPY nora-cli/Cargo.toml nora-cli/
|
|
|
|
# Create dummy sources for dependency caching
|
|
RUN mkdir -p nora-registry/src nora-storage/src nora-cli/src && \
|
|
echo "fn main() {}" > nora-registry/src/main.rs && \
|
|
echo "fn main() {}" > nora-storage/src/main.rs && \
|
|
echo "fn main() {}" > nora-cli/src/main.rs
|
|
|
|
# Build dependencies only (with cache)
|
|
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 --package nora-registry && \
|
|
rm -rf nora-registry/src nora-storage/src nora-cli/src
|
|
|
|
# Copy real sources
|
|
COPY nora-registry/src nora-registry/src
|
|
COPY nora-storage/src nora-storage/src
|
|
COPY nora-cli/src nora-cli/src
|
|
|
|
# Build release binary (with cache)
|
|
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
|
--mount=type=cache,target=/usr/local/cargo/git \
|
|
--mount=type=cache,target=/app/target \
|
|
touch nora-registry/src/main.rs && \
|
|
cargo build --release --package nora-registry && \
|
|
cp /app/target/release/nora /usr/local/bin/nora
|
|
|
|
# Runtime stage — scratch (compatible with RED OS, no foreign OS components)
|
|
# Switch FROM to registry.red-soft.ru/redos once registry access is configured
|
|
FROM scratch
|
|
|
|
# CA certificates for TLS
|
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
|
|
|
COPY --from=builder /usr/local/bin/nora /usr/local/bin/nora
|
|
|
|
ENV RUST_LOG=info
|
|
ENV NORA_HOST=0.0.0.0
|
|
ENV NORA_PORT=4000
|
|
ENV NORA_STORAGE_MODE=local
|
|
ENV NORA_STORAGE_PATH=/data/storage
|
|
ENV NORA_AUTH_TOKEN_STORAGE=/data/tokens
|
|
|
|
EXPOSE 4000
|
|
|
|
VOLUME ["/data"]
|
|
|
|
ENTRYPOINT ["/usr/local/bin/nora"]
|
|
CMD ["serve"]
|