refactor(dockerfile): rewrite using debian-slim as base image
- DART does not seem to work on Alpine - use Debian-slim base instead - change to entrypoint/cmd structure - pass cmd as shell script instead of JSON for now
This commit is contained in:
parent
2f9e6640cd
commit
8aae6c877f
44
Dockerfile
44
Dockerfile
@ -1,36 +1,47 @@
|
||||
#
|
||||
# Dart-SASS compiler on Alpine
|
||||
# Dart-SASS compiler on Debian-Slim
|
||||
#
|
||||
|
||||
ARG ALPINE_VERSION=3.14
|
||||
FROM alpine:${ALPINE_VERSION}
|
||||
ARG ALPINE_VERSION
|
||||
ARG SASS_VERSION=1.35.1
|
||||
ARG DEBIAN_VERSION=buster-slim
|
||||
FROM debian:${DEBIAN_VERSION}
|
||||
ARG DEBIAN_VERSION
|
||||
ARG SASS_VERSION=1.36.0
|
||||
|
||||
# create a limited user to run sass
|
||||
ARG SASS_UID=8101
|
||||
ARG SASS_GID=8101
|
||||
RUN addgroup -g ${SASS_GID} -S sass \
|
||||
&& adduser -S -u ${SASS_UID} -G sass -H -g 'sass system user' sass \
|
||||
&& mkdir -p /sass/sass /sass/css \
|
||||
&& chown -R sass:sass /sass
|
||||
RUN addgroup --system --gid ${SASS_GID} sass \
|
||||
&& adduser \
|
||||
--system \
|
||||
--uid ${SASS_UID} \
|
||||
--ingroup sass \
|
||||
--disabled-password \
|
||||
--no-create-home \
|
||||
--gecos 'sass system user' \
|
||||
sass \
|
||||
&& mkdir /sass /css \
|
||||
&& chown -R sass:sass /sass /css
|
||||
|
||||
# download dart-sass, tini and timezone support, update all packages
|
||||
RUN apk --update --no-cache add \
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y \
|
||||
tini \
|
||||
tzdata \
|
||||
&& apk --update --no-cache upgrade \
|
||||
wget \
|
||||
&& apt-get upgrade \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& wget https://github.com/sass/dart-sass/releases/download/${SASS_VERSION}/dart-sass-${SASS_VERSION}-linux-x64.tar.gz \
|
||||
-O /tmp/dart-sass-${SASS_VERSION}.tar.gz \
|
||||
&& tar -zxvf /tmp/dart-sass-${SASS_VERSION}.tar.gz dart-sass/sass -C /usr/local/bin/ --strip-components=1 \
|
||||
&& chmod +x /usr/local/bin/sass
|
||||
&& tar -zxvf /tmp/dart-sass-${SASS_VERSION}.tar.gz -C /opt/ \
|
||||
&& rm -f /tmp/dart-sass-${SASS_VERSION}.tar.gz \
|
||||
&& chmod +x /opt/dart-sass/sass
|
||||
|
||||
# labels
|
||||
MAINTAINER Asif Bacchus <asif@asifbacchus.dev>
|
||||
LABEL maintainer="Asif Bacchus <asif@asifbacchus.dev>"
|
||||
LABEL dev.asifbacchus.docker.internalName="ab-dart-sass"
|
||||
LABEL org.opencontainers.image.authors="Asif Bacchus <asif@asifbacchus.dev>"
|
||||
LABEL org.opencontainers.image.description="Dockerized implementation of Dart-SASS compiler running on Alpine Linux using a limited account."
|
||||
LABEL org.opencontainers.image.description="Dockerized implementation of Dart-SASS compiler running on Debian (slim) using a limited account."
|
||||
LABEL org.opencontainers.image.documentation="https://git.asifbacchus.dev/ab-docker/dart-sass/raw/branch/master/README.md"
|
||||
LABEL org.opencontainers.image.source="https://git.asifbacchus.dev/ab-docker/dart-sass.git"
|
||||
LABEL org.opencontainers.image.title="ab-dart-sass"
|
||||
@ -38,13 +49,14 @@ LABEL org.opencontainers.image.url="https://git.asifbacchus.dev/ab-docker/dart-s
|
||||
LABEL org.opencontainers.image.vendor="Asif Bacchus"
|
||||
|
||||
# default environment variables
|
||||
ENV PATH=$PATH:/opt/dart-sass
|
||||
ENV TZ=Etc/UTC
|
||||
ENV SASS_STYLE=compressed
|
||||
|
||||
# switch to user account and run sass compiler
|
||||
USER sass
|
||||
WORKDIR /sass
|
||||
ENTRYPOINT [ "/sbin/tini", "--", "/usr/local/bin/sass -s ${SASS_STYLE} --watch --poll --stop-on-error sass:css" ]
|
||||
ENTRYPOINT [ "/usr/bin/tini", "--" ]
|
||||
CMD /opt/dart-sass/sass -s ${SASS_STYLE} --watch --poll --stop-on-error /sass:/css
|
||||
|
||||
# set build timestamp, git and version labels
|
||||
ARG INTERNAL_VERSION
|
||||
|
Loading…
Reference in New Issue
Block a user