Skip to content

Commit

Permalink
Switched to Alpine Linux (fix of #1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Grutschus committed Jan 29, 2024
1 parent 9b39f87 commit 1d95411
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 20 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
insert_final_newline = true
tab_width = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_size = 2
69 changes: 69 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Docker Image
on:
push:
paths-ignore:
- "README.md"
- "LICENSE"
- ".editorconfig"
- ".github/workflows/auto-update.yml"
pull_request:
jobs:
docker-image-alpine:
strategy:
matrix:
# MUST ORDER versions ascending
rewinged:
- version: "1.0.1"
version_minor: "1.0"
version_major: "1"
download_hash: "e52eb417a5c0fb5a3b08a858c8d10fa797627ada5373e203c196162d6a313697"
latest: true
env:
IMAGE_NAME_FULL: "fabiang/guetzli:${{ matrix.rewinged.version }}-alpine"
IMAGE_NAME_MINOR: "fabiang/guetzli:${{ matrix.rewinged.version_minor }}-alpine"
IMAGE_NAME_MAJOR: "fabiang/guetzli:${{ matrix.rewinged.version_major }}-alpine"
DOCKER_BUILDKIT: 1
runs-on: ubuntu-latest
name: "Alpine v${{ matrix.rewinged.version }}"
steps:
- uses: actions/checkout@v3
- uses: jpribyl/action-docker-layer-caching@v0.1.1
continue-on-error: true
- name: Build Image
run: |
docker build -f alpine/Dockerfile \
-t '${{ env.IMAGE_NAME_FULL }}' \
\
--build-arg 'GUETZLI_VERSION=${{ matrix.rewinged.version }}' \
--build-arg 'GUETZLI_CHECKSUM_SHA256=${{ matrix.rewinged.download_hash }}' \
.
- name: Download Test Image
run: |
curl --fail -L -o bees.png https://raw.githubusercontent.com/google/guetzli/master/tests/bees.png
- name: Test Image
run: |
docker run -i -v $(pwd):/test -w /test --rm ${{ env.IMAGE_NAME_FULL }} bees.png bees.jpg
- name: Tag Minor
if: "${{ matrix.rewinged.version_minor != '' }}"
run: docker tag '${{ env.IMAGE_NAME_FULL }}' '${{ env.IMAGE_NAME_MINOR }}'
- name: Tag Major
if: "${{ matrix.rewinged.version_major != '' }}"
run: docker tag '${{ env.IMAGE_NAME_FULL }}' '${{ env.IMAGE_NAME_MAJOR }}'
- name: Docker Hub login
if: "${{ github.ref == 'refs/heads/main' }}"
uses: azure/docker-login@v1
with:
username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
password: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
- name: Push Image
if: "${{ github.ref == 'refs/heads/main' }}"
run: |
docker push '${{ env.IMAGE_NAME_FULL }}'
- name: Push Image Minor
if: "${{ matrix.rewinged.version_minor != '' && github.ref == 'refs/heads/main' }}"
run: |
docker push '${{ env.IMAGE_NAME_MINOR }}'
- name: Push Image Major
if: "${{ matrix.rewinged.version_major != '' && github.ref == 'refs/heads/main' }}"
run: |
docker push '${{ env.IMAGE_NAME_MAJOR }}'
20 changes: 0 additions & 20 deletions Dockerfile

This file was deleted.

28 changes: 28 additions & 0 deletions alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM alpine

ARG GUETZLI_VERSION=1.0.1
ARG GUETZLI_CHECKSUM_SHA256=e52eb417a5c0fb5a3b08a858c8d10fa797627ada5373e203c196162d6a313697

RUN apk add --update --no-cache --virtual .build \
gflags \
libpng-dev \
curl \
make \
g++ \
&& apk add --update --no-cache libpng libstdc++ libgcc \
&& curl -L --fail -o /tmp/guetzli.tar.gz \
https://github.com/google/guetzli/archive/refs/tags/v${GUETZLI_VERSION}.tar.gz \
&& echo "${GUETZLI_CHECKSUM_SHA256} /tmp/guetzli.tar.gz" > /tmp/guetzli_checksum.txt \
&& sha256sum -w -c /tmp/guetzli_checksum.txt \
&& mkdir /tmp/guetzli \
&& tar -zxv --strip-components=1 -f /tmp/guetzli.tar.gz -C /tmp/guetzli \
&& cd /tmp/guetzli \
&& make \
&& cp bin/Release/guetzli /usr/local/bin/guetzli \
&& rm -f /tmp/guetzli.tar.gz \
&& rm -rf /tmp/guetzli \
&& rm -f /tmp/guetzli_checksum.txt \
&& apk del .build

WORKDIR /guetzli
ENTRYPOINT ["guetzli"]

0 comments on commit 1d95411

Please sign in to comment.