Files
imks/Dockerfile
T
zhenyi c794b818ff feat(config): integrate etcd for service discovery and config management
- Add etcd-client dependency for distributed configuration storage
- Implement EtcdConfig with priority: etcd > environment variables > defaults
- Add ServiceRegistry for service registration with lease keep-alive
- Integrate etcd-based service discovery for appks gRPC connections
- Add service watcher for real-time service instance updates
- Migrate Redis configuration from single URL to cluster node list
- Update Dockerfile with default IMKS_HOST and IMKS_PORT environment variables
- Add etcd bootstrap configuration through environment variables
- Implement Redis cluster URL building with optional authentication
2026-06-11 22:50:38 +08:00

41 lines
1.0 KiB
Docker

FROM rust:1.96-bookworm AS chef
RUN apt-get update && \
apt-get install -y --no-install-recommends \
protobuf-compiler libprotobuf-dev mold clang && \
rm -rf /var/lib/apt/lists/*
RUN cargo install cargo-chef
WORKDIR /app
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN cargo build --release --bin imks && \
strip target/release/imks
FROM ubuntu:26.04
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates curl && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/target/release/imks /usr/local/bin/imks
COPY --from=builder /app/migrate/ /app/migrate/
WORKDIR /app
RUN useradd -m -u 1000 imks && chown -R imks:imks /app
USER imks
ENV IMKS_HOST=0.0.0.0
ENV IMKS_PORT=50048
EXPOSE 50048
HEALTHCHECK --interval=15s --timeout=3s --start-period=10s --retries=3 \
CMD curl -sf http://localhost:3000/health || exit 1
ENTRYPOINT ["imks"]