FROM registry.nxtgauge.com/rust:alpine AS builder RUN apk add --no-cache curl ca-certificates bash build-base musl-dev pkgconfig openssl-dev openssl-libs-static RUN update-ca-certificates RUN curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable ENV PATH="/root/.cargo/bin:${PATH}" RUN rustup target add x86_64-unknown-linux-musl WORKDIR /app COPY Cargo.toml Cargo.lock* ./ COPY src ./src COPY migrations ./migrations COPY seeds ./seeds ENV OPENSSL_STATIC=1 ENV OPENSSL_DIR=/usr RUN cargo build --release --target x86_64-unknown-linux-musl FROM registry.nxtgauge.com/alpine:3.20 RUN apk add --no-cache ca-certificates WORKDIR /app COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/nxtgauge-ai-assistant /usr/local/bin/nxtgauge-ai-assistant COPY --from=builder /app/migrations ./migrations COPY --from=builder /app/seeds ./seeds ENV APP_HOST=0.0.0.0 ENV APP_PORT=8080 EXPOSE 8080 CMD ["/usr/local/bin/nxtgauge-ai-assistant"]