-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContainerfile.crosscompile
27 lines (25 loc) · 1.21 KB
/
Containerfile.crosscompile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
FROM docker.io/library/rust:1.84-alpine AS chef
USER root
RUN apk add --no-cache build-base mingw-w64-gcc protobuf-dev git
COPY rust-toolchain.toml rust-toolchain.toml
RUN rustup show
RUN cargo install cargo-chef
RUN cargo install sqlx-cli --no-default-features --features rustls,sqlite
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 --profile release-lto --target x86_64-unknown-linux-musl --recipe-path recipe.json
RUN cargo chef cook --profile release-lto --target x86_64-pc-windows-gnu --recipe-path recipe.json
COPY migrations migrations
ENV DATABASE_URL=sqlite://docker-build.db?mode=rwc
RUN sqlx migrate run
COPY . .
RUN cargo build --profile release-lto --target x86_64-unknown-linux-musl
RUN cargo build --profile release-lto --target x86_64-pc-windows-gnu
RUN mkdir -p /app/build/release/
RUN cp /app/target/x86_64-unknown-linux-musl/release-lto/meshstellar /app/build/release/meshstellar-linux-x86_64
RUN cp /app/target/x86_64-pc-windows-gnu/release-lto/meshstellar.exe /app/build/release/meshstellar-windows-x86_64.exe
RUN cp meshstellar.toml.example /app/build/release/meshstellar.toml.example