ci: use rustup toolchain for musl builds

This commit is contained in:
Tracewebstudio Dev 2026-04-17 03:10:13 +02:00
parent a8d545c019
commit 68da5140f8

View file

@ -1,17 +1,22 @@
FROM registry.nxtgauge.com/rust:alpine AS builder FROM registry.nxtgauge.com/rust:alpine AS builder
RUN command -v cargo >/dev/null 2>&1 || apk add --no-cache cargo rust RUN apk add --no-cache curl ca-certificates bash build-base musl-dev pkgconfig openssl-dev openssl-libs-static
RUN apk add --no-cache musl-dev pkgconfig openssl-dev 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 WORKDIR /app
COPY Cargo.toml Cargo.lock* ./ COPY Cargo.toml Cargo.lock* ./
COPY src ./src COPY src ./src
COPY migrations ./migrations COPY migrations ./migrations
COPY seeds ./seeds COPY seeds ./seeds
RUN cargo build --release 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 FROM registry.nxtgauge.com/alpine:3.20
RUN apk add --no-cache ca-certificates RUN apk add --no-cache ca-certificates
WORKDIR /app WORKDIR /app
COPY --from=builder /app/target/release/nxtgauge-ai-assistant /usr/local/bin/nxtgauge-ai-assistant 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/migrations ./migrations
COPY --from=builder /app/seeds ./seeds COPY --from=builder /app/seeds ./seeds
ENV APP_HOST=0.0.0.0 ENV APP_HOST=0.0.0.0