-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (25 loc) · 1.27 KB
/
Dockerfile
File metadata and controls
29 lines (25 loc) · 1.27 KB
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
28
29
FROM ghcr.io/inkroomtemp/rust_musl_build:1.85.0
RUN cargo new app
WORKDIR /workdir/app
RUN cargo new derive --lib && cargo new lib --lib && echo "extern crate proc_macro;" > derive/src/lib.rs
COPY Cargo.toml /workdir/app
COPY lib/Cargo.toml /workdir/app/lib/Cargo.toml
COPY derive/Cargo.toml /workdir/app/derive/Cargo.toml
RUN cargo build --release -vv --target=$(arch)-unknown-linux-musl --all-features
VOLUME /root/.cargo/git
VOLUME /root/.cargo/registry
COPY . /workdir/app
RUN rm -rf target/$(arch)-unknown-linux-musl/release/deps/iepub-* \
&& rm -rf target/$(arch)-unknown-linux-musl/release/deps/libiepub* \
&& rm -rf target/$(arch)-unknown-linux-musl/release/deps/tool-* \
&& rm -rf target/$(arch)-unknown-linux-musl/release/deps/derive-* \
&& rm -rf target/$(arch)-unknown-linux-musl/release/deps/libderive* \
&& rm -rf target/release/deps/libiepub* \
&& rm -rf target/release/deps/iepub-* \
&& rm -rf target/release/deps/tool-* \
&& rm -rf target/release/deps/derive-* \
&& rm -rf target/release/deps/libderive*
RUN cargo build --release --target=$(arch)-unknown-linux-musl && cp target/$(arch)-unknown-linux-musl/release/iepub ./iepub-tool && chmod +x ./iepub-tool
FROM scratch
COPY --from=0 /workdir/app/iepub-tool /iepub-tool
CMD ["/iepub-tool"]