diff --git a/Dockerfile b/Dockerfile index 1968e16..71f3aad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,28 @@ -FROM ubuntu:18.04 +FROM ubuntu:20.04 + +LABEL maintainer="Drew Short " \ + name="acm" \ + version="1.2.0" \ + description="Prepackaged ACM with defaults and tooling" ENV LC_ALL=C.UTF-8 ENV LANG=C.UTF-8 +ENV DEBIAN_FRONTEND=noninteractive ARG MOZJPEG_VERSION="3.3.1" # Install tooling (ffmpeg, opusenc, optipng, python3) -RUN apt-get update \ - && apt-get install -y \ +RUN ln -fs /usr/share/zoneinfo/UCT /etc/localtime \ + && apt-get update -y \ + && apt-get install -y --fix-missing \ + curl \ ffmpeg \ - python3 \ - python3-pip \ opus-tools \ optipng \ - curl + python3 \ + python3-pip \ + tzdata \ + webp WORKDIR /tmp @@ -43,8 +52,11 @@ COPY docker/acm acm # Make script executable RUN chmod +x acm -WORKDIR /project +VOLUME ["/input", "/output"] + +WORKDIR /app +COPY acm-config.json.example acm-config.json COPY docker/entrypoint.sh . -CMD ["sh", "/project/entrypoint.sh"] +CMD ["sh", "-c", "find /input/ -type f | /app/entrypoint.sh --stdin --remove-prefix /input/ compress -p default -d /output/"] diff --git a/acm-config-default.json b/acm-config-default.json index 6a23ee6..576f192 100644 --- a/acm-config-default.json +++ b/acm-config-default.json @@ -79,6 +79,25 @@ "command": "cp {input_file} {output_file}" } }, + "webp": { + "jpeg": { + "processors": ["cwebp"], + "extensions": [ + "jpg", + "jpeg" + ], + "outputExtension": "webp", + "command": "cwebp -jpeg_like -q 90 -o {output_file} {input_file}" + }, + "png": { + "processors": ["cwebp"], + "extensions": [ + "png" + ], + "outputExtension": "webp", + "command": "cwebp -lossless -o {output_file} {input_file}" + } + }, "aggressive": { "jpeg": { "processors": ["ffmpeg", "cjpeg"], @@ -115,6 +134,43 @@ "outputExtension": "ogg", "command": "ffmpeg -hide_banner -loglevel panic -i {input_file} -f wav -| opusenc --bitrate 64 --vbr --downmix-stereo --discard-comments --discard-pictures - {output_file}" } + }, + "aggressive-webp": { + "jpeg": { + "processors": ["cwebp"], + "extensions": [ + "jpg", + "jpeg" + ], + "outputExtension": "webp", + "command": "export FILE={output_file} && export TEMP_FILE=${FILE}_tmp.jpg && ffmpeg -i {input_file} -vf scale=-1:720 ${TEMP_FILE} && cwebp -jpeg_like -q 75 -o {output_file} ${TEMP_FILE} && rm ${TEMP_FILE}" + }, + "png": { + "processors": ["cwebp"], + "extensions": [ + "png" + ], + "outputExtension": "webp", + "command": "cwebp -o {output_file} ${input_file}" + }, + "video": { + "processors": ["ffmpeg"], + "extensions": [ + "mp4", + "webm" + ], + "outputExtension": "webm", + "command": "ffmpeg -hide_banner -loglevel panic -i {input_file} -vf scale=-1:720 -c:v libvpx-vp9 -b:v 0 -crf 38 -c:a libopus {output_file}" + }, + "audio": { + "processors": ["ffmpeg", "opusenc"], + "extensions": [ + "wav", + "mp3" + ], + "outputExtension": "ogg", + "command": "ffmpeg -hide_banner -loglevel panic -i {input_file} -f wav -| opusenc --bitrate 64 --vbr --downmix-stereo --discard-comments --discard-pictures - {output_file}" + } } } }