init-wrapper/Dockerfile

38 lines
858 B
Docker
Raw Normal View History

2024-03-06 05:03:44 +09:00
#syntax=docker/dockerfile:1
##
## Build
##
FROM rust:1-alpine3.19 AS build
LABEL org.opencontainers.image.authors="Sangbum Kim <sangbumkim@amuz.es>"
# set the workdir and copy the source into it
WORKDIR /app
COPY . /app
ENV RUSTFLAGS='-C panic=abort -C link-arg=-s -C link-arg=-fuse-ld=lld'
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 && \
cargo build --release && \
ls -alh target/release/init-wrapper
# ldd target/release/init-wrapper && \
2024-03-06 05:03:44 +09:00
# && \
# ldd target/release/init-wrapper
# RUN --mount=type=bind,rw,source=.,target=/host \
# cp -avf target/release/init-wrapper /host/init-wrapper && \
# ./target/release/init-wrapper
FROM scratch
COPY --from=build /app/target/release/init-wrapper /init-wrapper
# ENTRYPOINT ['/init-wrapper']