41 lines
846 B
Docker
41 lines
846 B
Docker
FROM ubuntu:23.10 AS builder
|
|
|
|
ARG DI_VER=1.2.5
|
|
|
|
RUN apt update && \
|
|
apt install -y --no-install-recommends \
|
|
curl ca-certificates \
|
|
build-essential \
|
|
musl musl-dev musl-tools
|
|
|
|
WORKDIR /app
|
|
|
|
# Build dumb-init
|
|
RUN curl -Lo - "https://github.com/Yelp/dumb-init/archive/refs/tags/v${DI_VER}.tar.gz" | tar -xzf - && \
|
|
cd "dumb-init-${DI_VER}" && \
|
|
make SHELL=/bin/sh && \
|
|
mv dumb-init .. && \
|
|
cd ..
|
|
|
|
COPY . ./
|
|
|
|
RUN make CFLAGS='-O3' LDFLAGS='-flto -static' && \
|
|
strip build/lander && \
|
|
readelf -d build/lander && \
|
|
[ "$(readelf -d build/lander | grep NEEDED | wc -l)" = 0 ]
|
|
|
|
|
|
FROM busybox:1.36.1
|
|
|
|
RUN mkdir /data && \
|
|
chown -R 1000:1000 /data
|
|
|
|
COPY --from=builder /app/build/lander /app/dumb-init /bin/
|
|
|
|
WORKDIR /data
|
|
|
|
USER 1000:1000
|
|
|
|
ENTRYPOINT ["/bin/dumb-init", "--"]
|
|
CMD ["/bin/lander"]
|