2023-11-14 15:34:07 +01:00
|
|
|
FROM ubuntu:23.10 AS builder
|
2022-11-15 21:12:08 +01:00
|
|
|
|
2022-11-15 21:24:00 +01:00
|
|
|
ARG DI_VER=1.2.5
|
|
|
|
|
2023-11-14 15:34:07 +01:00
|
|
|
RUN apt update && \
|
|
|
|
apt install -y --no-install-recommends \
|
|
|
|
curl ca-certificates \
|
|
|
|
build-essential \
|
|
|
|
musl musl-dev musl-tools
|
2022-11-15 21:12:08 +01:00
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
2022-11-15 21:24:00 +01:00
|
|
|
# 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 ..
|
|
|
|
|
2022-11-15 21:12:08 +01:00
|
|
|
COPY . ./
|
|
|
|
|
2023-11-14 15:34:07 +01:00
|
|
|
RUN make CFLAGS='-O3' LDFLAGS='-flto -static' && \
|
2023-05-29 17:16:17 +02:00
|
|
|
strip build/lander && \
|
2023-07-28 21:08:48 +02:00
|
|
|
readelf -d build/lander && \
|
2023-05-29 17:16:17 +02:00
|
|
|
[ "$(readelf -d build/lander | grep NEEDED | wc -l)" = 0 ]
|
2022-11-15 21:24:00 +01:00
|
|
|
|
|
|
|
|
2023-05-29 17:16:17 +02:00
|
|
|
FROM busybox:1.36.1
|
2022-11-15 21:24:00 +01:00
|
|
|
|
2023-05-29 17:16:17 +02:00
|
|
|
RUN mkdir /data && \
|
2022-11-15 21:24:00 +01:00
|
|
|
chown -R 1000:1000 /data
|
|
|
|
|
2023-05-29 17:16:17 +02:00
|
|
|
COPY --from=builder /app/build/lander /app/dumb-init /bin/
|
2022-11-15 21:24:00 +01:00
|
|
|
|
|
|
|
WORKDIR /data
|
|
|
|
|
|
|
|
USER 1000:1000
|
|
|
|
|
|
|
|
ENTRYPOINT ["/bin/dumb-init", "--"]
|
|
|
|
CMD ["/bin/lander"]
|