2024-03-06 05:03:44 +09:00
|
|
|
#syntax=docker/dockerfile:1
|
|
|
|
|
|
|
|
##
|
|
|
|
## Build
|
|
|
|
##
|
2024-07-22 02:27:12 +09:00
|
|
|
FROM rust:1-alpine3.20 AS build
|
2024-03-06 05:03:44 +09:00
|
|
|
LABEL org.opencontainers.image.authors="Sangbum Kim <sangbumkim@amuz.es>"
|
|
|
|
|
|
|
|
# set the workdir and copy the source into it
|
|
|
|
WORKDIR /app
|
|
|
|
COPY . /app
|
|
|
|
|
2024-07-22 02:27:12 +09:00
|
|
|
|
|
|
|
ENV RUSTFLAGS='-Cpanic=abort -Crelocation-model=static -Clink-args=-Wl,-x,-s,-fuse-ld=lld,--as-needed,--gc-sections,--no-gnu-unique,--nostdlib,--no-pie,--build-id=none,--no-eh-frame-hdr'
|
2024-03-06 05:03:44 +09:00
|
|
|
|
|
|
|
RUN set -x && \
|
|
|
|
apk add --no-cache \
|
|
|
|
libcap-static \
|
|
|
|
libcap-dev \
|
|
|
|
lld \
|
|
|
|
musl-dev
|
|
|
|
|
|
|
|
RUN set -x && \
|
2024-07-22 02:27:12 +09:00
|
|
|
cargo build --release -- -C prefer-dynamic&& \
|
|
|
|
objcopy -R .eh_frame -R .got.plt target/release/init-wrapper target/release/init-wrapper && \
|
|
|
|
ls -alh target/release/init-wrapper && \
|
|
|
|
readelf -W -S ./target/release/init-wrapper
|
|
|
|
# && \
|
|
|
|
# ./target/release/init-wrapper
|
2024-03-10 01:53:57 +09:00
|
|
|
# ldd target/release/init-wrapper && \
|
2024-03-06 05:03:44 +09:00
|
|
|
# && \
|
|
|
|
# ldd target/release/init-wrapper
|
|
|
|
|
2024-07-22 02:27:12 +09:00
|
|
|
RUN --mount=type=bind,rw,source=.,target=/host \
|
|
|
|
cp -avf target/release/init-wrapper /host/init-wrapper && \
|
|
|
|
./target/release/init-wrapper
|
2024-03-06 05:03:44 +09:00
|
|
|
|
|
|
|
|
|
|
|
FROM scratch
|
|
|
|
COPY --from=build /app/target/release/init-wrapper /init-wrapper
|
|
|
|
|
|
|
|
|
|
|
|
# ENTRYPOINT ['/init-wrapper']
|