2024-01-21 20:40:19 +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 link-arg=-s -C link-arg=-fuse-ld=lld'
|
|
|
|
|
|
|
|
RUN set -x && \
|
|
|
|
apk add --no-cache \
|
|
|
|
libcap-static \
|
|
|
|
libcap-dev \
|
|
|
|
lld \
|
|
|
|
musl-dev &&\
|
|
|
|
cargo build --release && \
|
|
|
|
ldd target/release/setcap-static
|
|
|
|
|
|
|
|
# RUN --mount=type=bind,rw,source=.,target=/host \
|
|
|
|
# cp -avf target/release/setcap-static /host/setcap-static
|
|
|
|
|
2024-01-02 00:04:24 +09:00
|
|
|
|
|
|
|
FROM scratch
|
2024-01-21 20:40:19 +09:00
|
|
|
COPY --from=build /app/target/release/setcap-static /setcap-static
|