-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e7b51d0
Showing
3 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Docker Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- v* | ||
jobs: | ||
build: | ||
uses: NaturalSelectionLabs/Daedalus/.github/workflows/docker-tpl.yaml@main | ||
with: | ||
images: rss3/thumbor | ||
context: . | ||
dockerfile: ./Dockerfile | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FROM debian:bullseye-slim as mozjpeg | ||
ENV VERSION 3.3.1 | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends autoconf automake checkinstall libpng-dev libtool make nasm pkg-config && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
ADD https://github.com/mozilla/mozjpeg/archive/v$VERSION.tar.gz /usr/local/share | ||
|
||
WORKDIR /usr/local/share | ||
RUN mkdir mozjpeg && \ | ||
tar --strip-components=1 --extract --file v$VERSION.tar.gz -C mozjpeg mozjpeg-$VERSION/ | ||
|
||
WORKDIR /usr/local/share/mozjpeg | ||
RUN autoreconf -fiv && \ | ||
mkdir build | ||
|
||
WORKDIR /usr/local/share/mozjpeg/build | ||
RUN ../configure && make | ||
|
||
FROM mvhirsch/thumbor:7.5.2 | ||
|
||
RUN pip install --user --no-cache-dir thumbor-gcs thumbor-plugins | ||
|
||
COPY --from=mozjpeg /usr/local/share/mozjpeg/build /usr/local/share/mozjpeg/build | ||
RUN ln -s /usr/local/share/mozjpeg/build/cjpeg /usr/local/bin/mozjpeg | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends pngquant && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY fundamentals.sh /docker-entrypoint.init.d/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/sh | ||
|
||
# mozjpeg | ||
echo "MOZJPEG_PATH = '/usr/local/bin/mozjpeg'" >> /usr/local/thumbor/thumbor.conf | ||
echo "MOZJPEG_QUALITY = 80" >> /usr/local/thumbor/thumbor.conf | ||
|
||
# pngquant | ||
echo "PNGQUANT_PATH = '/usr/bin/pngquant'" >> /usr/local/thumbor/thumbor.conf | ||
echo "PNGQUANT_SPEED = 3" >> /usr/local/thumbor/thumbor.conf | ||
|
||
# set OPTIMIZERS | ||
echo "OPTIMIZERS = ['thumbor_plugins.optimizers.mozjpeg', 'thumbor_plugins.optimizers.pngquant']" >> /usr/local/thumbor/thumbor.conf | ||
|
||
# configure gcs | ||
GCS=$(cat <<EOF | ||
################################# GCS Storage ################################## | ||
## GCS Bucket where thumbor's loader will fetch images from. | ||
LOADER = 'thumbor_gcs.loader.gcs_loader' | ||
## GCS Bucket ID where thumbor's loader will fetch images from. | ||
LOADER_GCS_BUCKET_ID = '{{ LOADER_GCS_BUCKET_ID | default('') }}' | ||
## GCS Project ID where thumbor's loader will fetch images from. | ||
LOADER_GCS_PROJECT_ID = '{{ LOADER_GCS_PROJECT_ID | default('') }}' | ||
## GCS Root Path where thumbor's loader will fetch images from. | ||
LOADER_GCS_ROOT_PATH = '{{ LOADER_GCS_ROOT_PATH | default('') }}' | ||
## GCS Bucket ID where thumbor's result storage will store images. | ||
RESULT_STORAGE = 'thumbor_gcs.result_storage.gcs_result_storage' | ||
## GCS Bucket ID where thumbor's result storage will store images. | ||
RESULT_STORAGE_GCS_BUCKET_ID = '{{ RESULT_STORAGE_GCS_BUCKET_ID | default('') }}' | ||
## GCS Project ID where thumbor's result storage will store images. | ||
RESULT_STORAGE_GCS_PROJECT_ID = '{{ RESULT_STORAGE_GCS_PROJECT_ID | default('') }}' | ||
## GCS Root Path where thumbor's result storage will store images. | ||
RESULT_STORAGE_GCS_ROOT_PATH = '{{ RESULT_STORAGE_GCS_ROOT_PATH | default('') }}' | ||
################################################################################ | ||
EOF | ||
) | ||
|
||
echo -e "$GCS" | envtpl >> /usr/local/thumbor/thumbor.conf |