just throwin there

This commit is contained in:
spushk 2026-05-15 22:27:28 +05:00 • committed by spushk
commit 278d7cf05d
Signed by: spushk
GPG key ID: 7797B761E105E8AA

65
Containerfile Normal file
View file

@ -0,0 +1,65 @@
FROM source.spushk.ru/rustyworks/rust-alpine-mimalloc:1.95 as build
WORKDIR /build
ENV OPENSSL_DIR=/usr
ENV TARGET_CC=x86_64-linux-musl-clang
ENV CARGO_BUILD_TARGET=x86_64-unknown-linux-musl
COPY .cargo .cargo
COPY rust-toolchain.toml rust-toolchain.toml
RUN --mount=type=secret,id=cargo-token \
--mount=type=cache,target=/usr/local/rustup,id=rustup_cache \
cat /run/secrets/cargo-token | cargo login --quiet --registry Technologygeek
FROM build as planner
WORKDIR /build
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry,id=cargo_registry \
--mount=type=cache,target=/usr/local/rustup,id=rustup_cache \
cargo chef prepare --recipe-path=recipe.json
FROM build as build-debug
WORKDIR /build
COPY --from=planner /build/recipe.json recipe.json
RUN --mount=type=cache,target=/usr/local/cargo/registry,id=cargo_registry \
--mount=type=cache,target=/usr/local/rustup,id=rustup_cache \
cargo --config=.cargo/container_debug.toml \
chef cook --recipe-path=recipe.json
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry,id=cargo_registry \
--mount=type=cache,target=/usr/local/rustup,id=rustup_cache \
cargo --config=.cargo/container_debug.toml \
test
RUN --mount=type=cache,target=/usr/local/cargo/registry,id=cargo_registry \
--mount=type=cache,target=/usr/local/rustup,id=rustup_cache \
cargo --config=.cargo/container_debug.toml \
build
FROM build as build-release
WORKDIR /build
COPY --from=planner /build/recipe.json recipe.json
RUN --mount=type=cache,target=/usr/local/cargo/registry,id=cargo_registry \
--mount=type=cache,target=/usr/local/rustup,id=rustup_cache \
cargo --config=.cargo/container_release.toml \
chef cook --release --recipe-path=recipe.json
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry,id=cargo_registry \
--mount=type=cache,target=/usr/local/rustup,id=rustup_cache \
cargo --config=.cargo/container_release.toml \
build --release
FROM scratch as app
WORKDIR /
VOLUME /adsbot.db
VOLUME /adsbot.log
EXPOSE 3000
FROM app as app-debug
WORKDIR /
COPY --from=build-debug /build/target/x86_64-unknown-linux-musl/debug/adsbot /adsbot
ENV RUST_LOG="debug"
ENTRYPOINT [ "/adsbot" ]
FROM app as app-release
WORKDIR /
COPY --from=build-release /build/target/x86_64-unknown-linux-musl/release/adsbot /adsbot
ENV RUST_LOG="info"
ENTRYPOINT [ "/adsbot" ]