From 5fb0d81590f360e337969b858ae79f24ed150d30 Mon Sep 17 00:00:00 2001 From: Andrew Gouin Date: Thu, 23 Feb 2023 10:05:34 -0700 Subject: [PATCH] Add extra utils (#7) --- Dockerfile | 25 ++++++++++++++++++++----- busybox.min.config | 42 +++++++++++++++++++++--------------------- native.Dockerfile | 25 ++++++++++++++++++++----- 3 files changed, 61 insertions(+), 31 deletions(-) diff --git a/Dockerfile b/Dockerfile index 48cbaf9..1bbbe3a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -FROM --platform=$BUILDPLATFORM alpine:3 AS busybox-min +FROM --platform=$BUILDPLATFORM alpine:3 AS build-env -RUN apk add --no-cache \ +RUN apk add --update --no-cache \ bash \ curl \ eudev-dev \ @@ -9,7 +9,12 @@ RUN apk add --no-cache \ libc-dev \ linux-headers \ make \ - wget + wget \ + bison \ + flex \ + automake \ + autoconf \ + libtool ARG TARGETARCH ARG BUILDARCH @@ -44,20 +49,30 @@ RUN if [ "${TARGETARCH}" = "arm64" ] && [ "${BUILDARCH}" != "arm64" ]; then \ fi; \ make +# Static jq +WORKDIR / +RUN git clone --recursive -b jq-1.6 --single-branch https://github.com/stedolan/jq.git +WORKDIR /jq +RUN autoreconf -fi;\ + ./configure --with-oniguruma=builtin;\ + make LDFLAGS=-all-static + FROM boxboat/config-merge:latest as config-merge FROM alpine:3 RUN apk add --no-cache \ curl \ - jq \ lz4 \ nano \ npm \ wget # Install busybox -COPY --from=busybox-min /busybox/busybox /busybox/busybox +COPY --from=build-env /busybox/busybox /busybox/busybox + +# Install jq +COPY --from=build-env /jq/jq /usr/local/bin/jq # Add config-merge COPY --from=config-merge /usr/local/config-merge /usr/local/config-merge diff --git a/busybox.min.config b/busybox.min.config index 67483fa..6e146c8 100644 --- a/busybox.min.config +++ b/busybox.min.config @@ -199,7 +199,7 @@ CONFIG_FEATURE_TAR_NOPRESERVE_TIME=y # # CONFIG_FEATURE_TIMEZONE is not set # CONFIG_FEATURE_PRESERVE_HARDLINKS is not set -# CONFIG_FEATURE_HUMAN_READABLE is not set +CONFIG_FEATURE_HUMAN_READABLE=y # CONFIG_BASENAME is not set CONFIG_CAT=y # CONFIG_FEATURE_CATN is not set @@ -217,17 +217,17 @@ CONFIG_CAT=y # CONFIG_FEATURE_CP_REFLINK is not set # CONFIG_CUT is not set # CONFIG_FEATURE_CUT_REGEX is not set -# CONFIG_DATE is not set -# CONFIG_FEATURE_DATE_ISOFMT is not set -# CONFIG_FEATURE_DATE_NANO is not set -# CONFIG_FEATURE_DATE_COMPAT is not set +CONFIG_DATE=y +CONFIG_FEATURE_DATE_ISOFMT=y +CONFIG_FEATURE_DATE_NANO=y +CONFIG_FEATURE_DATE_COMPAT=y # CONFIG_DD is not set # CONFIG_FEATURE_DD_SIGNAL_HANDLING is not set # CONFIG_FEATURE_DD_THIRD_STATUS_LINE is not set # CONFIG_FEATURE_DD_IBS_OBS is not set # CONFIG_FEATURE_DD_STATUS is not set -# CONFIG_DF is not set -# CONFIG_FEATURE_DF_FANCY is not set +CONFIG_DF=y +CONFIG_FEATURE_DF_FANCY=y # CONFIG_FEATURE_SKIP_ROOTFS is not set # CONFIG_DIRNAME is not set # CONFIG_DOS2UNIX is not set @@ -244,8 +244,8 @@ CONFIG_ENV=y # CONFIG_FACTOR is not set # CONFIG_FALSE is not set # CONFIG_FOLD is not set -# CONFIG_HEAD is not set -# CONFIG_FEATURE_FANCY_HEAD is not set +CONFIG_HEAD=y +CONFIG_FEATURE_FANCY_HEAD=y # CONFIG_HOSTID is not set # CONFIG_ID is not set # CONFIG_GROUPS is not set @@ -264,11 +264,11 @@ CONFIG_FEATURE_LS_TIMESTAMPS=y CONFIG_FEATURE_LS_USERNAME=y CONFIG_FEATURE_LS_COLOR=y CONFIG_FEATURE_LS_COLOR_IS_DEFAULT=y -# CONFIG_MD5SUM is not set -# CONFIG_SHA1SUM is not set -# CONFIG_SHA256SUM is not set -# CONFIG_SHA512SUM is not set -# CONFIG_SHA3SUM is not set +CONFIG_MD5SUM=y +CONFIG_SHA1SUM=y +CONFIG_SHA256SUM=y +CONFIG_SHA512SUM=y +CONFIG_SHA3SUM=y # CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set # CONFIG_MKDIR is not set # CONFIG_MKFIFO is not set @@ -293,7 +293,7 @@ CONFIG_PWD=y # CONFIG_SHRED is not set # CONFIG_SHUF is not set CONFIG_SLEEP=y -# CONFIG_FEATURE_FANCY_SLEEP is not set +CONFIG_FEATURE_FANCY_SLEEP=y # CONFIG_SORT is not set # CONFIG_FEATURE_SORT_BIG is not set # CONFIG_FEATURE_SORT_OPTIMIZE_MEMORY is not set @@ -302,14 +302,14 @@ CONFIG_SLEEP=y # CONFIG_STAT is not set # CONFIG_FEATURE_STAT_FORMAT is not set # CONFIG_FEATURE_STAT_FILESYSTEM is not set -# CONFIG_STTY is not set +CONFIG_STTY=y # CONFIG_SUM is not set # CONFIG_SYNC is not set # CONFIG_FEATURE_SYNC_FANCY is not set # CONFIG_FSYNC is not set # CONFIG_TAC is not set -# CONFIG_TAIL is not set -# CONFIG_FEATURE_FANCY_TAIL is not set +CONFIG_TAIL=y +CONFIG_FEATURE_FANCY_TAIL=y CONFIG_TEE=y # CONFIG_FEATURE_TEE_USE_BLOCK_IO is not set # CONFIG_TEST is not set @@ -319,7 +319,7 @@ CONFIG_TEE=y # CONFIG_TIMEOUT is not set # CONFIG_TOUCH is not set # CONFIG_FEATURE_TOUCH_SUSV3 is not set -# CONFIG_TR is not set +CONFIG_TR=y # CONFIG_FEATURE_TR_CLASSES is not set # CONFIG_FEATURE_TR_EQUIV is not set # CONFIG_TRUE is not set @@ -380,7 +380,7 @@ CONFIG_DEFAULT_SETFONT_DIR="" # CONFIG_START_STOP_DAEMON is not set # CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS is not set # CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set -# CONFIG_WHICH is not set +CONFIG_WHICH=y # # klibc-utils @@ -1057,7 +1057,7 @@ CONFIG_FEATURE_MIME_CHARSET="" # CONFIG_FEATURE_TOPMEM is not set # CONFIG_UPTIME is not set # CONFIG_FEATURE_UPTIME_UTMP_SUPPORT is not set -# CONFIG_WATCH is not set +CONFIG_WATCH=y # # Runit Utilities diff --git a/native.Dockerfile b/native.Dockerfile index 4dfb980..d56da02 100644 --- a/native.Dockerfile +++ b/native.Dockerfile @@ -1,6 +1,6 @@ -FROM alpine:3 AS busybox-min +FROM alpine:3 AS build-env -RUN apk add --no-cache \ +RUN apk add --update --no-cache \ bash \ curl \ eudev-dev \ @@ -9,7 +9,12 @@ RUN apk add --no-cache \ libc-dev \ linux-headers \ make \ - wget + wget \ + bison \ + flex \ + automake \ + autoconf \ + libtool # Build minimal busybox WORKDIR / @@ -19,20 +24,30 @@ WORKDIR /busybox ADD busybox.min.config .config RUN make +# Static jq +WORKDIR / +RUN git clone --recursive -b jq-1.6 --single-branch https://github.com/stedolan/jq.git +WORKDIR /jq +RUN autoreconf -fi;\ + ./configure --with-oniguruma=builtin;\ + make LDFLAGS=-all-static + FROM boxboat/config-merge:latest as config-merge FROM alpine:3 RUN apk add --no-cache \ curl \ - jq \ lz4 \ nano \ npm \ wget # Install busybox -COPY --from=busybox-min /busybox/busybox /busybox/busybox +COPY --from=build-env /busybox/busybox /busybox/busybox + +# Install jq +COPY --from=build-env /jq/jq /usr/local/bin/jq # Add config-merge COPY --from=config-merge /usr/local/config-merge /usr/local/config-merge