Put fully static binaries into containers
This commit is contained in:
parent
4abb24feca
commit
294ae8fd24
|
|
@ -22,6 +22,11 @@ default-members = [
|
|||
"radicle-remote-helper",
|
||||
]
|
||||
|
||||
[profile.container]
|
||||
inherits = "release"
|
||||
debug = true
|
||||
incremental = false
|
||||
|
||||
[patch.crates-io.nakamoto-net]
|
||||
git = "https://github.com/cloudhead/nakamoto"
|
||||
rev = "90cc3eac67aa5cfd5f42cf7cb1e2b155af3214fb"
|
||||
|
|
|
|||
|
|
@ -1,21 +1,20 @@
|
|||
# Build
|
||||
FROM rust:1.65.0-slim@sha256:27349440d16ac15f52e8cae6181999a1b2fc05272d612a358d0e53078fcef88e as build
|
||||
FROM registry.gitlab.com/rust_musl_docker/image:stable-1.65.0@sha256:f95635740757e0e9a29b51d5060a7564e900cb5192defdd3a5b2ba5b47ce17b3 as build
|
||||
|
||||
RUN apt-get update && apt-get install -y pkg-config libssl-dev git cmake
|
||||
COPY . /workdir
|
||||
|
||||
COPY . /app
|
||||
WORKDIR /app/radicle-httpd
|
||||
RUN rustup target add x86_64-unknown-linux-musl
|
||||
|
||||
RUN set -eux; \
|
||||
cargo install --locked --path .; \
|
||||
objcopy --compress-debug-sections /usr/local/cargo/bin/radicle-httpd /usr/local/cargo/bin/radicle-httpd.compressed
|
||||
WORKDIR /workdir/radicle-httpd
|
||||
RUN RUSTFLAGS=-Cforce-frame-pointers=yes cargo build --profile=container --target=x86_64-unknown-linux-musl
|
||||
RUN objcopy --compress-debug-sections /workdir/target/x86_64-unknown-linux-musl/container/radicle-httpd /workdir/target/x86_64-unknown-linux-musl/container/radicle-httpd.compressed
|
||||
|
||||
# Run
|
||||
FROM debian:bullseye-slim@sha256:25f10b4f1ded5341a3ca0a30290ff3cd5639415f0c5a2222d5e7d5dd72952aa1
|
||||
|
||||
RUN echo deb http://deb.debian.org/debian bullseye-backports main contrib non-free >/etc/apt/sources.list.d/backports.list
|
||||
RUN apt-get update && apt-get install -y libssl1.1 && apt -t bullseye-backports install --yes git && rm -rf /var/lib/apt/lists/*
|
||||
COPY --from=build /usr/local/cargo/bin/radicle-httpd.compressed /usr/local/bin/radicle-httpd
|
||||
COPY --from=build /workdir/target/x86_64-unknown-linux-musl/container/radicle-httpd.compressed /usr/local/bin/radicle-httpd
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
# Build
|
||||
FROM rust:1.65.0-slim@sha256:27349440d16ac15f52e8cae6181999a1b2fc05272d612a358d0e53078fcef88e as build
|
||||
FROM registry.gitlab.com/rust_musl_docker/image:stable-1.65.0@sha256:f95635740757e0e9a29b51d5060a7564e900cb5192defdd3a5b2ba5b47ce17b3 as build
|
||||
|
||||
RUN apt-get update && apt-get install -y pkg-config libssl-dev git cmake
|
||||
COPY . /workdir
|
||||
|
||||
COPY . /app
|
||||
WORKDIR /app/radicle-node
|
||||
RUN rustup target add x86_64-unknown-linux-musl
|
||||
|
||||
RUN set -eux; \
|
||||
cargo install --locked --path .; \
|
||||
objcopy --compress-debug-sections /usr/local/cargo/bin/radicle-node /usr/local/cargo/bin/radicle-node.compressed
|
||||
WORKDIR /workdir/radicle-node
|
||||
|
||||
RUN RUSTFLAGS=-Cforce-frame-pointers=yes cargo build --profile=container --target=x86_64-unknown-linux-musl
|
||||
RUN objcopy --compress-debug-sections /workdir/target/x86_64-unknown-linux-musl/container/radicle-node /workdir/target/x86_64-unknown-linux-musl/container/radicle-node.compressed
|
||||
|
||||
# Run
|
||||
FROM debian:bullseye-slim@sha256:25f10b4f1ded5341a3ca0a30290ff3cd5639415f0c5a2222d5e7d5dd72952aa1
|
||||
|
||||
RUN echo deb http://deb.debian.org/debian bullseye-backports main contrib non-free >/etc/apt/sources.list.d/backports.list
|
||||
RUN apt-get update && apt-get install -y libssl1.1 && apt -t bullseye-backports install --yes git && rm -rf /var/lib/apt/lists/*
|
||||
COPY --from=build /usr/local/cargo/bin/radicle-node.compressed /usr/local/bin/radicle-node
|
||||
COPY --from=build /workdir/target/x86_64-unknown-linux-musl/container/radicle-node.compressed /usr/local/bin/radicle-node
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue