From 3d476db982cf6c10fdee890ccd9303e3775c69ac Mon Sep 17 00:00:00 2001 From: Florin Lungu Date: Sat, 30 Nov 2024 18:11:20 +0100 Subject: [PATCH 1/2] switch from dart-sass-embedded to dart-sass --- src/docker/_base/_main.df | 2 +- src/docker/_base/{sass-embedded.df => sass.df} | 4 ++-- src/docker/debian-ext/Dockerfile | 2 +- src/docker/ubuntu-ext/Dockerfile | 2 +- src/files/_script/{sass-embedded.sh => sass.sh} | 13 ++++++++----- 5 files changed, 13 insertions(+), 10 deletions(-) rename src/docker/_base/{sass-embedded.df => sass.df} (59%) rename src/files/_script/{sass-embedded.sh => sass.sh} (56%) diff --git a/src/docker/_base/_main.df b/src/docker/_base/_main.df index b061579e..b6e92192 100644 --- a/src/docker/_base/_main.df +++ b/src/docker/_base/_main.df @@ -10,7 +10,7 @@ IMPORT nodejs AS nodejs IMPORT pandoc AS pandoc -IMPORT sass-embedded AS sass-embedded +IMPORT sass AS sass IMPORT files AS files diff --git a/src/docker/_base/sass-embedded.df b/src/docker/_base/sass.df similarity index 59% rename from src/docker/_base/sass-embedded.df rename to src/docker/_base/sass.df index b5e4dcc7..c650f56c 100644 --- a/src/docker/_base/sass-embedded.df +++ b/src/docker/_base/sass.df @@ -2,8 +2,8 @@ FROM base--image--alpine AS fetcher ARG TARGETPLATFORM -ADD _script/sass-embedded.sh sass-embedded.sh -RUN sh sass-embedded.sh +ADD _script/sass.sh sass.sh +RUN sh sass.sh diff --git a/src/docker/debian-ext/Dockerfile b/src/docker/debian-ext/Dockerfile index 969821ea..a483b1d2 100644 --- a/src/docker/debian-ext/Dockerfile +++ b/src/docker/debian-ext/Dockerfile @@ -2,7 +2,7 @@ FROM scratch as image COPY --from=base--hugo--extended / / COPY --from=base--pandoc / / -COPY --from=base--sass-embedded / / +COPY --from=base--sass / / #COPY --from=base--nodejs--glibc / / diff --git a/src/docker/ubuntu-ext/Dockerfile b/src/docker/ubuntu-ext/Dockerfile index 423ad6d5..c006a571 100644 --- a/src/docker/ubuntu-ext/Dockerfile +++ b/src/docker/ubuntu-ext/Dockerfile @@ -2,7 +2,7 @@ FROM scratch as image COPY --from=base--hugo--extended / / COPY --from=base--pandoc / / -COPY --from=base--sass-embedded / / +COPY --from=base--sass / / #COPY --from=base--nodejs--glibc / / diff --git a/src/files/_script/sass-embedded.sh b/src/files/_script/sass.sh similarity index 56% rename from src/files/_script/sass-embedded.sh rename to src/files/_script/sass.sh index 857798eb..513d0d93 100644 --- a/src/files/_script/sass-embedded.sh +++ b/src/files/_script/sass.sh @@ -6,7 +6,7 @@ set -e set -u # Variables -SASS_EMBEDDED_VERSION="1.62.1" +SASS_VERSION="1.81.0" # Architecture TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64} @@ -21,12 +21,15 @@ else fi # Download -wget https://github.com/sass/dart-sass-embedded/releases/download/${SASS_EMBEDDED_VERSION}/sass_embedded-${SASS_EMBEDDED_VERSION}-linux-${ARCH}.tar.gz \ - -O /sass-embedded.tar.gz +wget https://github.com/sass/dart-sass/releases/download/${SASS_VERSION}/dart-sass-${SASS_VERSION}-linux-${ARCH}.tar.gz \ + -O /sass.tar.gz # Unpack mkdir -p /files/usr/local/lib /files/usr/local/bin -tar -zxvf sass-embedded.tar.gz -C /files/usr/local/lib +tar -zxvf sass.tar.gz -C /files/usr/local/lib # Create symlink -ln -s /usr/local/lib/sass_embedded/dart-sass-embedded /files/usr/local/bin/dart-sass-embedded +ln -s /usr/local/lib/dart-sass/sass /files/usr/local/bin/sass + +# Create alias for saas --embedded +alias dart-sass-embedded="sass --embedded" \ No newline at end of file From 0b9a12c6b7eeec51fdc40fe6323e675d648ee508 Mon Sep 17 00:00:00 2001 From: Florin Lungu Date: Sat, 30 Nov 2024 20:34:23 +0100 Subject: [PATCH 2/2] updates --- src/docker/_imports/default_nonroot_user.df | 2 +- src/docker/_imports/default_nonroot_user_alpine.df | 2 +- src/docker/alpine-ext/ext-alpine.df | 2 +- src/docker/alpine/alpine.df | 2 +- src/docker/busybox/Dockerfile | 2 +- src/docker/debian/base.df | 2 +- src/docker/ubuntu-ext/Dockerfile | 4 ++-- src/docker/ubuntu/base.df | 2 +- src/files/_script/sass.sh | 7 ++++++- 9 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/docker/_imports/default_nonroot_user.df b/src/docker/_imports/default_nonroot_user.df index 45c4997f..92793c68 100644 --- a/src/docker/_imports/default_nonroot_user.df +++ b/src/docker/_imports/default_nonroot_user.df @@ -1,4 +1,4 @@ # Create a custom user with UID 1234 and GID 1234 RUN getent group hugo 2>&1 > /dev/null || groupadd -g 1234 hugo && \ - getent passwd hugo 2>&1 > /dev/null || useradd -m -u 1234 -g hugo hugo + getent passwd hugo 2>&1 > /dev/null || useradd -m -u 1234 -g hugo hugo \ No newline at end of file diff --git a/src/docker/_imports/default_nonroot_user_alpine.df b/src/docker/_imports/default_nonroot_user_alpine.df index 59569d17..5b22397f 100644 --- a/src/docker/_imports/default_nonroot_user_alpine.df +++ b/src/docker/_imports/default_nonroot_user_alpine.df @@ -1,2 +1,2 @@ RUN getent group hugo 2>&1 > /dev/null || addgroup -g 1234 hugo \ - && getent passwd hugo 2>&1 > /dev/null || adduser -u 1234 -D -H -G hugo -g "" hugo + && getent passwd hugo 2>&1 > /dev/null || adduser -u 1234 -D -H -G hugo -g "" hugo \ No newline at end of file diff --git a/src/docker/alpine-ext/ext-alpine.df b/src/docker/alpine-ext/ext-alpine.df index 6252cd83..69e4058c 100644 --- a/src/docker/alpine-ext/ext-alpine.df +++ b/src/docker/alpine-ext/ext-alpine.df @@ -20,7 +20,7 @@ ENV HUGO_BIND="0.0.0.0" \ NODE_PATH=".:/usr/local/lib/node_modules:/usr/local/node/lib/node_modules" \ PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/node/bin" \ GOROOT="/usr/local/lib/go" \ - HOME="/tmp" + HOME="/home/hugo" USER root diff --git a/src/docker/alpine/alpine.df b/src/docker/alpine/alpine.df index 154557eb..ecabe9ef 100644 --- a/src/docker/alpine/alpine.df +++ b/src/docker/alpine/alpine.df @@ -13,7 +13,7 @@ IMPORT ../_imports/version_arg ENV HUGO_BIND="0.0.0.0" \ HUGO_DESTINATION="public" \ HUGO_ENV="DEV" \ - HOME="/tmp" + HOME="/home/hugo" COPY --from=image / / USER root diff --git a/src/docker/busybox/Dockerfile b/src/docker/busybox/Dockerfile index a3340cd4..e0775ca4 100644 --- a/src/docker/busybox/Dockerfile +++ b/src/docker/busybox/Dockerfile @@ -14,7 +14,7 @@ ENV HUGO_BIND="0.0.0.0" \ HUGO_DESTINATION="public" \ HUGO_ENV="DEV" \ HUGO_EDITION="standard" \ - HOME="/tmp" + HOME="/home/hugo" COPY --from=image / / diff --git a/src/docker/debian/base.df b/src/docker/debian/base.df index d85c3a94..818b8170 100644 --- a/src/docker/debian/base.df +++ b/src/docker/debian/base.df @@ -5,7 +5,7 @@ IMPORT ../_imports/version_arg ENV HUGO_BIND="0.0.0.0" \ HUGO_DESTINATION="public" \ HUGO_ENV="DEV" \ - HOME="/tmp" + HOME="/home/hugo" USER root IMPORT ../_imports/default_nonroot_user.df diff --git a/src/docker/ubuntu-ext/Dockerfile b/src/docker/ubuntu-ext/Dockerfile index c006a571..cd53fd4e 100644 --- a/src/docker/ubuntu-ext/Dockerfile +++ b/src/docker/ubuntu-ext/Dockerfile @@ -60,8 +60,8 @@ RUN true \ && chmod a+wrx /src /target \ # # add /src to safe.directory - && git config --global --add safe.directory /src - + && git config --global --add safe.directory /src + COPY --from=base--golang / / VOLUME [ "/src", "/target" ] diff --git a/src/docker/ubuntu/base.df b/src/docker/ubuntu/base.df index 507b5f90..17334d4e 100644 --- a/src/docker/ubuntu/base.df +++ b/src/docker/ubuntu/base.df @@ -5,7 +5,7 @@ IMPORT ../_imports/version_arg ENV HUGO_BIND="0.0.0.0" \ HUGO_DESTINATION="public" \ HUGO_ENV="DEV" \ - HOME="/tmp" + HOME="/home/hugo" COPY --from=base--files--ubuntu / / diff --git a/src/files/_script/sass.sh b/src/files/_script/sass.sh index 513d0d93..a4f2fb62 100644 --- a/src/files/_script/sass.sh +++ b/src/files/_script/sass.sh @@ -32,4 +32,9 @@ tar -zxvf sass.tar.gz -C /files/usr/local/lib ln -s /usr/local/lib/dart-sass/sass /files/usr/local/bin/sass # Create alias for saas --embedded -alias dart-sass-embedded="sass --embedded" \ No newline at end of file +mkdir -p /files/etc/profile.d /files/home/hugo +echo 'alias dart-sass-embedded="sass --embedded"' > /files/etc/profile.d/dart-sass-embedded.sh +echo 'alias dart-sass-embedded="sass --embedded"' > /files/home/hugo/.bash_aliases + +# Make script executable +chmod a+x /files/etc/profile.d/dart-sass-embedded.sh