2025-12-03 19:31:49 +01:00
|
|
|
ARG ALPINE_VERSION=latest
|
|
|
|
|
FROM alpine:$ALPINE_VERSION AS builder
|
|
|
|
|
|
|
|
|
|
ARG RUST_VERSION=stable
|
|
|
|
|
|
|
|
|
|
COPY Cargo.lock /usr/src/
|
|
|
|
|
COPY Cargo.toml /usr/src/
|
|
|
|
|
|
|
|
|
|
WORKDIR /usr/src
|
|
|
|
|
|
2025-12-04 21:45:59 +01:00
|
|
|
RUN apk add --no-cache rustup build-base openssl-dev openssl-libs-static && \
|
2025-12-03 19:31:49 +01:00
|
|
|
rustup-init -qy --profile=minimal --default-toolchain=$RUST_VERSION && \
|
|
|
|
|
source "$HOME/.cargo/env" && \
|
|
|
|
|
mkdir src && echo "fn main() {}" > src/main.rs && \
|
|
|
|
|
cargo fetch && \
|
|
|
|
|
cargo build --release --target=x86_64-unknown-linux-musl && \
|
|
|
|
|
rm src/main.rs
|
|
|
|
|
|
|
|
|
|
COPY src/ /usr/src/src/
|
2025-12-04 21:48:53 +01:00
|
|
|
COPY templates/ /usr/src/templates/
|
2025-12-03 19:31:49 +01:00
|
|
|
|
|
|
|
|
RUN source "$HOME/.cargo/env" && \
|
|
|
|
|
touch src/main.rs && \
|
|
|
|
|
cargo build --release --target=x86_64-unknown-linux-musl
|
|
|
|
|
|
|
|
|
|
FROM alpine:$ALPINE_VERSION
|
|
|
|
|
|
|
|
|
|
COPY --from=builder /usr/src/target/x86_64-unknown-linux-musl/release/aoszdos /usr/bin/
|
|
|
|
|
|
|
|
|
|
CMD [ "/usr/bin/aoszdos" ]
|