Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync with origin #1

Open
wants to merge 67 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
8ca3660
Add blog URL (#261)
n0vad3v Jul 24, 2023
9250d6f
Optimize README.md (#262)
n0vad3v Jul 26, 2023
5dba6bb
M1 should be arm64 (#263)
n0vad3v Jul 29, 2023
4003b03
Multiple backends support (#207)
bugfest Aug 2, 2023
6790ddd
Add support for Go 1.21, bump version, optimize code (#264)
n0vad3v Aug 9, 2023
ab43732
apt update before apt install (#265)
n0vad3v Aug 9, 2023
d9da7f3
Remove metadata when original not exist, update support for heic (#266)
n0vad3v Aug 17, 2023
523294e
fix image exist nil (#274)
BennyThink Sep 15, 2023
5d265dc
Parse flat before load config (#275)
n0vad3v Sep 15, 2023
c54b8be
Use compiled libwebp (#276)
n0vad3v Sep 15, 2023
51dde5e
Remove ARMv7 (#277)
n0vad3v Sep 15, 2023
0b0e5b1
Upgrade github.com/gofiber/fiber (#278)
n0vad3v Sep 18, 2023
655fb1d
Add env on startup (#283)
n0vad3v Oct 17, 2023
d98740c
ISSUE-281 Add NEF support by convert to jpg (#284)
llanc Oct 30, 2023
4a90b18
Fix bug that could remove original image (#287)
n0vad3v Nov 4, 2023
543af24
Better configuration (#288)
n0vad3v Nov 5, 2023
4f39a1c
Unify ENV (#289)
n0vad3v Nov 5, 2023
ace5642
Bump golang.org/x/image from 0.5.0 to 0.10.0 (#290)
dependabot[bot] Nov 11, 2023
cd0b87c
Bump github.com/gofiber/fiber/v2 from 2.50.0 to 2.51.0 (#294)
dependabot[bot] Nov 22, 2023
d7d4c37
Bump github.com/valyala/fasthttp from 1.50.0 to 1.51.0 (#293)
dependabot[bot] Nov 22, 2023
290b233
fix: incorrect cache key (#286)
HolgerHuo Nov 22, 2023
84bd4c6
Bump github.com/schollz/progressbar/v3 from 3.13.1 to 3.14.1 (#291)
dependabot[bot] Nov 22, 2023
cc26be0
Add healthz endpoint (#296)
n0vad3v Nov 23, 2023
0d4856c
fix: metadata not updated when remote file changes (#297)
HolgerHuo Nov 23, 2023
d67601a
Fix link in README.md and fix CI permission (#299)
n0vad3v Nov 24, 2023
c771160
Ignore GIF when converting to AVIF (#302)
n0vad3v Dec 1, 2023
d83f666
Refine convert part (#303)
n0vad3v Dec 16, 2023
484c876
Bump to 0.10.4 (#304)
n0vad3v Dec 18, 2023
d35e0e0
Lock on convert (#307)
n0vad3v Dec 29, 2023
1ec981b
Read all pages (#308)
n0vad3v Dec 29, 2023
0dc7a0f
Bump github.com/gofiber/fiber/v2 from 2.51.0 to 2.52.0 (#309)
dependabot[bot] Feb 10, 2024
12d4cc1
Upgrade to Go 1.22 (#311)
n0vad3v Feb 10, 2024
123c96d
add: cache for remote images (#310)
HolgerHuo Feb 11, 2024
9be1a6b
Fix tests, bump version (#312)
n0vad3v Feb 11, 2024
c921561
Bump github.com/valyala/fasthttp from 1.51.0 to 1.52.0 (#314)
dependabot[bot] Feb 20, 2024
eb2b6d1
Bump govips to 2.14 (#317)
n0vad3v Feb 26, 2024
55c04d2
Bump github.com/gofiber/fiber/v2 from 2.52.0 to 2.52.1 (#315)
dependabot[bot] Feb 27, 2024
61880e2
Bump github.com/schollz/progressbar/v3 from 3.14.1 to 3.14.2 (#316)
dependabot[bot] Feb 29, 2024
ca1050d
Optimized Dockerfile, bump version (#318)
n0vad3v Feb 29, 2024
5a9b4ed
Bump github.com/gofiber/fiber/v2 from 2.52.1 to 2.52.2 (#320)
dependabot[bot] Mar 4, 2024
ddcb532
Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 (#319)
dependabot[bot] Mar 4, 2024
43c275e
Adds JPEG XL support, max_height/max_width support (#321)
n0vad3v Mar 22, 2024
ac30605
Bump github.com/gofiber/fiber/v2 from 2.52.2 to 2.52.3 (#323)
dependabot[bot] Mar 26, 2024
8c15bf3
Bump github.com/gofiber/fiber/v2 from 2.52.3 to 2.52.4 (#324)
dependabot[bot] Apr 10, 2024
b5842b2
Allow jxl based on Accept header (#326)
n0vad3v Apr 10, 2024
c7bebfc
Add EXTRA_PARAMS_CROP_INTERESTING (#328)
n0vad3v Apr 19, 2024
be32328
Fix Malformed dir traversal (#331)
BennyThink Apr 23, 2024
e69c3a2
Bump golang.org/x/net from 0.21.0 to 0.23.0 (#329)
dependabot[bot] Apr 23, 2024
74c6aa6
--- (#334)
dependabot[bot] May 21, 2024
d9c542d
Bump github.com/davidbyttow/govips/v2 to 2.15.0 (#337)
syedcherry Jun 7, 2024
5b3e2f3
Bump golang.org/x/image from 0.17.0 to 0.18.0 (#340)
dependabot[bot] Jun 27, 2024
53487b5
Bump github.com/valyala/fasthttp from 1.52.0 to 1.55.0 (#339)
dependabot[bot] Jun 27, 2024
81c6e78
Bump github.com/schollz/progressbar/v3 from 3.14.3 to 3.14.4 (#338)
dependabot[bot] Jun 27, 2024
f207e3c
Update README (#343)
n0vad3v Jun 28, 2024
89ea0af
Add `MAX_CACHE_SIZE` config (#344)
n0vad3v Jun 29, 2024
d29959c
Bump to 0.12.0 (#345)
n0vad3v Jun 29, 2024
a0ee22a
Bump github.com/gofiber/fiber/v2 from 2.52.4 to 2.52.5 (#346)
dependabot[bot] Jul 1, 2024
80d6a04
Bump github.com/schollz/progressbar/v3 from 3.14.4 to 3.14.5 (#348)
dependabot[bot] Aug 4, 2024
d400f52
Bump github.com/schollz/progressbar/v3 from 3.14.5 to 3.14.6 (#350)
dependabot[bot] Aug 5, 2024
89aea97
Bump to Go 1.23 (#353)
n0vad3v Aug 16, 2024
ae0274c
Add iOS 18 support (#360)
n0vad3v Oct 30, 2024
a08b6e6
Use newer version of libaom (#363)
n0vad3v Nov 13, 2024
e696ee9
Add prefetch-foreground (#365)
n0vad3v Nov 25, 2024
8d24d70
Bump github.com/stretchr/testify from 1.9.0 to 1.10.0 (#366)
dependabot[bot] Nov 26, 2024
ec27023
Bump github.com/schollz/progressbar/v3 from 3.14.6 to 3.17.1 (#362)
dependabot[bot] Nov 26, 2024
3f732e8
WebP Server Go 0.13.0 (#367)
n0vad3v Jan 1, 2025
95b112e
Bump github.com/gofiber/fiber/v2 from 2.52.5 to 2.52.6 (#372)
dependabot[bot] Jan 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
.github/*
exhaust/*
pics/*
remote-raw/*
scripts/*
.git
.dockerignore
README.md
LICENSE
Makefile
LICENSE
52 changes: 16 additions & 36 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -1,64 +1,43 @@
name: CI check on every PR
on:
pull_request:
branches:
- master
paths-ignore:
- '**.md'
- 'Makefile'
- 'config.json'

jobs:
ci:
name: CI check on every push and PR
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Go
uses: actions/setup-go@v3
with:
go-version: '1.20'

- name: Setup necessary packages
run: |
sudo apt install libvips-dev -y

- name: run test cases
run: make && make test

image-test:
name: Check for image build and CVE
name: Check for image build, testing and CVE
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
uses: actions/cache@v2
- name: Make test
uses: docker/build-push-action@v6
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
context: .
file: ./Dockerfile.CI
load: true
tags: |
ghcr.io/${{ github.event.repository.full_name }}:latest

- name: Build and load image
uses: docker/build-push-action@v3
- name: Build image test
uses: docker/build-push-action@v6
with:
context: .
load: true
tags: |
ghcr.io/${{ github.event.repository.full_name }}:latest

cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: Install trivy
run: |
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo apt-key add -
Expand All @@ -77,11 +56,12 @@ jobs:
run: |
echo "${{ steps.trivy.outputs.stdout }}"

- name: Comment PR
- name: Comment PR for CVE
uses: thollander/actions-comment-pull-request@v2
with:
message: |
```
${{ steps.trivy.outputs.stdout }}
```
comment_tag: cve
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: '1.23'

- name: Setup necessary packages
run: |
sudo apt install libvips-dev -y
sudo apt update && sudo apt install libvips-dev -y

- name: run test cases
run: make && make test
Expand Down
28 changes: 6 additions & 22 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '32 20 * * 2'
Expand All @@ -33,38 +32,23 @@ jobs:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.23'

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
24 changes: 17 additions & 7 deletions .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install docker-compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose

- name: Build image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
Expand All @@ -32,7 +37,7 @@ jobs:
- name: Send Requests to Server
run: |
cd pics
find * -type f -print | xargs -I {} curl -H "User-Agent: Mozilla/5.0 Gecko/20100101 Firefox/98.0" http://localhost:3333/{}
find * -type f -print | xargs -I {} curl -o /dev/null -H "Accept: image/webp" --silent http://localhost:3333/{}

- name: Get container RAM stats
run: |
Expand All @@ -43,10 +48,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

uses: actions/checkout@v4

- name: Install docker-compose
run: |
sudo apt-get update
sudo apt-get install -y docker-compose

- name: Build image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
Expand All @@ -61,7 +71,7 @@ jobs:
- name: Send Requests to Server
run: |
cd pics
find * -type f -print | xargs -I {} curl -H "User-Agent: Mozilla/5.0 Gecko/20100101 Firefox/98.0" http://localhost:3333/{}
find * -type f -print | xargs -I {} curl -o /dev/null -H "Accept: image/webp" --silent http://localhost:3333/{}

- name: Get container RAM stats
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release_binary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Make WebP Server Go (amd64)
run: |
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release_docker_image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

Expand Down Expand Up @@ -43,10 +43,10 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
uses: actions/cache@v2
Expand All @@ -57,10 +57,10 @@ jobs:
${{ runner.os }}-buildx-

- name: Build and push latest images
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/arm,linux/amd64,linux/arm64
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20-bookworm as builder
FROM golang:1.23-bookworm AS builder

ARG IMG_PATH=/opt/pics
ARG EXHAUST_PATH=/opt/exhaust
Expand All @@ -14,7 +14,12 @@ RUN cd /build && sed -i "s|.\/pics|${IMG_PATH}|g" config.json \

FROM debian:bookworm-slim

RUN apt update && apt install --no-install-recommends libvips ca-certificates libjemalloc2 libtcmalloc-minimal4 -y && rm -rf /var/lib/apt/lists/* && rm -rf /var/cache/apt/archives/*
RUN apt update && apt install --no-install-recommends libvips ca-certificates libjemalloc2 libtcmalloc-minimal4 curl -y && rm -rf /var/lib/apt/lists/* && rm -rf /var/cache/apt/archives/*

COPY ./assets /build/assets
# Install libam with correct arch
RUN dpkg -i /build/assets/libaom3_3.11.0-1_$(dpkg --print-architecture).deb && \
rm /build/assets/libaom3_3.11.0-1_$(dpkg --print-architecture).deb

COPY --from=builder /build/webp-server /usr/bin/webp-server
COPY --from=builder /build/config.json /etc/config.json
Expand Down
11 changes: 11 additions & 0 deletions Dockerfile.CI
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM golang:1.23-bookworm AS builder

ARG IMG_PATH=/opt/pics
ARG EXHAUST_PATH=/opt/exhaust
RUN apt update && apt install --no-install-recommends libvips-dev -y && mkdir /build
COPY go.mod /build
RUN cd /build && go mod download

COPY . /build

RUN cd /build && make && make test
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ else
endif

ifeq ($(shell uname -m),aarch64)
ARCH=arm64
ARCH=arm64
else ifeq ($(shell uname -m),arm64)
ARCH=arm64
else
ARCH=amd64
ARCH=amd64
endif

default:
Expand All @@ -24,7 +26,7 @@ tools-dir:

install-staticcheck: tools-dir
GOBIN=`pwd`/tools/bin go install honnef.co/go/tools/cmd/staticcheck@latest
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b ./tools/bin v1.52.2
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b ./tools/bin v1.59.1

static-check: install-staticcheck
#S1000,SA1015,SA4006,SA4011,S1023,S1034,ST1003,ST1005,ST1016,ST1020,ST1021
Expand All @@ -35,8 +37,7 @@ test:
go test -v -coverprofile=coverage.txt -covermode=atomic ./...

clean:
rm -rf prefetch remote-raw exhaust tools coverage.txt

rm -rf prefetch remote-raw exhaust tools coverage.txt metadata exhaust_test

docker:
DOCKER_BUILDKIT=1 docker build -t webpsh/webps .
Loading