Repository navigation
Expand file tree
/
Copy pathDockerfile.squashfs-tools
More file actions
39 lines (35 loc) · 1.67 KB
/
Copy pathDockerfile.squashfs-tools
File metadata and controls
39 lines (35 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
FROM alpine:latest AS build
# We would be fine using 4.7.5 (latest) except for needing
# https://github.com/plougher/squashfs-tools/commit/a044577948aa09e6f10ce5cf95292f8971ac66b9 and
# https://github.com/plougher/squashfs-tools/commit/52992df017ea9f80e37012947538249547a0d048
# to fix https://github.com/edera-dev/protect/issues/3655
# There is a build failure with `XZ_SUPPORT = 0` in some later revision.
ARG SQUASHFS_TOOLS_VERSION=52992df017ea9f80e37012947538249547a0d048
WORKDIR /usr/src
# build dependencies
RUN apk update && apk add build-base cmake git sed zstd-dev zstd-static
# build zlib-ng in static lib/"zlib-compat" mode (alpine doesn't have a static/dev variant yet)
ENV ZLIB_NG_VERSION=2.2.4
RUN git clone https://github.com/zlib-ng/zlib-ng.git && cd zlib-ng && git checkout $ZLIB_NG_VERSION
WORKDIR /usr/src/zlib-ng
RUN cmake . -DZLIB_COMPAT=1
RUN cmake --build . --config Release
RUN cmake --build . --target install
# check out squashfs-tools sources
WORKDIR /usr/src
ENV SQUASHFS_TOOLS_VERSION=${SQUASHFS_TOOLS_VERSION}
RUN git clone https://github.com/plougher/squashfs-tools && cd squashfs-tools && git checkout $SQUASHFS_TOOLS_VERSION
WORKDIR /usr/src/squashfs-tools/squashfs-tools
# We don't use most of these libs, so turn them off.
RUN sed -i \
-e 's/LZO_SUPPORT = 1/LZO_SUPPORT = 0/' \
-e 's/XZ_SUPPORT = 1/XZ_SUPPORT = 0/' \
-e 's/LZ4_SUPPORT = 1/LZ4_SUPPORT = 0/' \
-e 's/USE_PREBUILT_MANPAGES = n/USE_PREBUILT_MANPAGES = y/' \
Makefile
ENV CFLAGS="-O2 -Wall -static"
ENV LDFLAGS="-static"
RUN make -j`nproc` && make install INSTALL_DIR=/usr/obj/usr/bin
## copy final squashfs-tools into a scratch image
FROM scratch AS final
COPY --from=build /usr/obj/ /