Skip to content

Commit 1ffdc3d

Browse files
committed
publish
1 parent 4a67d5e commit 1ffdc3d

File tree

10 files changed

+1004
-0
lines changed

10 files changed

+1004
-0
lines changed

.github/workflows/ci.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
# test:
14+
# runs-on: ubuntu-latest
15+
# steps:
16+
# - uses: actions/checkout@v4
17+
#
18+
# - name: Set up Go
19+
# uses: actions/setup-go@v4
20+
# with:
21+
# go-version: 1.21
22+
#
23+
# - name: Cache Go modules
24+
# uses: actions/cache@v3
25+
# with:
26+
# path: ~/go/pkg/mod
27+
# key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
28+
#
29+
# - name: Run tests
30+
# run: go test -v ./...
31+
32+
docker:
33+
runs-on: ubuntu-latest
34+
#needs: test
35+
if: github.event_name == 'push'
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- name: Set up Docker Buildx
40+
uses: docker/setup-buildx-action@v2
41+
42+
- name: Login to GHCR
43+
uses: docker/login-action@v2
44+
with:
45+
registry: ghcr.io
46+
username: ${{ github.actor }}
47+
password: ${{ secrets.GITHUB_TOKEN }}
48+
49+
- name: Build and push
50+
uses: docker/build-push-action@v4
51+
with:
52+
context: .
53+
push: true
54+
tags: |
55+
ghcr.io/${{ env.IMAGE_NAME }}:latest
56+
ghcr.io/${{ env.IMAGE_NAME }}:${{ github.sha }}
57+
cache-from: type=gha
58+
cache-to: type=gha,mode=max
59+
60+
- name: Scan for vulnerabilities
61+
uses: aquasecurity/trivy-action@master
62+
with:
63+
image-ref: ghcr.io/${{ env.IMAGE_NAME }}:${{ github.sha }}
64+
format: 'table'
65+
exit-code: '1'
66+
ignore-unfixed: true
67+
severity: 'HIGH,CRITICAL'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.env.dev

Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM golang:1.24-alpine AS builder
2+
RUN apk add --no-cache git
3+
4+
WORKDIR /app
5+
6+
# Copy Go module files
7+
COPY go.mod go.sum ./
8+
RUN go mod download
9+
10+
# Copy source code
11+
COPY start_processes.sh main.go ./
12+
13+
# Build the proxy
14+
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w" -o proxy .
15+
16+
# Final stage using official imgproxy
17+
FROM ghcr.io/imgproxy/imgproxy:v3.30
18+
19+
# Copy our proxy binary
20+
COPY --from=builder /app/proxy /usr/local/bin/
21+
COPY start_processes.sh /usr/local/bin/
22+
23+
EXPOSE 8080
24+
25+
# Start proxy (which will start the cache proxy & imgproxy)
26+
CMD ["/usr/local/bin/start_processes.sh"]

LICENSE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2025 Matthieu Jacquot
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

go.mod

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
module github.com/err0r500/imgproxy-cache
2+
3+
go 1.24.0
4+
5+
toolchain go1.24.1
6+
7+
require (
8+
github.com/aws/aws-sdk-go-v2 v1.39.3
9+
github.com/aws/aws-sdk-go-v2/config v1.31.13
10+
github.com/aws/aws-sdk-go-v2/credentials v1.18.17
11+
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.19.13
12+
github.com/aws/aws-sdk-go-v2/service/s3 v1.88.5
13+
github.com/testcontainers/testcontainers-go v0.39.0
14+
)
15+
16+
require (
17+
dario.cat/mergo v1.0.2 // indirect
18+
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
19+
github.com/Microsoft/go-winio v0.6.2 // indirect
20+
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.2 // indirect
21+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.10 // indirect
22+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.10 // indirect
23+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.10 // indirect
24+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
25+
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.10 // indirect
26+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.2 // indirect
27+
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.1 // indirect
28+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.10 // indirect
29+
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.10 // indirect
30+
github.com/aws/aws-sdk-go-v2/service/sso v1.29.7 // indirect
31+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.2 // indirect
32+
github.com/aws/aws-sdk-go-v2/service/sts v1.38.7 // indirect
33+
github.com/aws/smithy-go v1.23.1 // indirect
34+
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
35+
github.com/containerd/errdefs v1.0.0 // indirect
36+
github.com/containerd/errdefs/pkg v0.3.0 // indirect
37+
github.com/containerd/log v0.1.0 // indirect
38+
github.com/containerd/platforms v0.2.1 // indirect
39+
github.com/cpuguy83/dockercfg v0.3.2 // indirect
40+
github.com/davecgh/go-spew v1.1.1 // indirect
41+
github.com/distribution/reference v0.6.0 // indirect
42+
github.com/docker/docker v28.3.3+incompatible // indirect
43+
github.com/docker/go-connections v0.6.0 // indirect
44+
github.com/docker/go-units v0.5.0 // indirect
45+
github.com/ebitengine/purego v0.8.4 // indirect
46+
github.com/felixge/httpsnoop v1.0.4 // indirect
47+
github.com/go-logr/logr v1.4.3 // indirect
48+
github.com/go-logr/stdr v1.2.2 // indirect
49+
github.com/go-ole/go-ole v1.2.6 // indirect
50+
github.com/gogo/protobuf v1.3.2 // indirect
51+
github.com/google/uuid v1.6.0 // indirect
52+
github.com/klauspost/compress v1.18.0 // indirect
53+
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
54+
github.com/magiconair/properties v1.8.10 // indirect
55+
github.com/moby/docker-image-spec v1.3.1 // indirect
56+
github.com/moby/go-archive v0.1.0 // indirect
57+
github.com/moby/patternmatcher v0.6.0 // indirect
58+
github.com/moby/sys/sequential v0.6.0 // indirect
59+
github.com/moby/sys/user v0.4.0 // indirect
60+
github.com/moby/sys/userns v0.1.0 // indirect
61+
github.com/moby/term v0.5.0 // indirect
62+
github.com/morikuni/aec v1.0.0 // indirect
63+
github.com/opencontainers/go-digest v1.0.0 // indirect
64+
github.com/opencontainers/image-spec v1.1.1 // indirect
65+
github.com/pkg/errors v0.9.1 // indirect
66+
github.com/pmezard/go-difflib v1.0.0 // indirect
67+
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
68+
github.com/shirou/gopsutil/v4 v4.25.6 // indirect
69+
github.com/sirupsen/logrus v1.9.3 // indirect
70+
github.com/stretchr/testify v1.11.1 // indirect
71+
github.com/tklauser/go-sysconf v0.3.12 // indirect
72+
github.com/tklauser/numcpus v0.6.1 // indirect
73+
github.com/yusufpapurcu/wmi v1.2.4 // indirect
74+
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
75+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
76+
go.opentelemetry.io/otel v1.38.0 // indirect
77+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect
78+
go.opentelemetry.io/otel/metric v1.38.0 // indirect
79+
go.opentelemetry.io/otel/sdk v1.38.0 // indirect
80+
go.opentelemetry.io/otel/trace v1.38.0 // indirect
81+
go.opentelemetry.io/proto/otlp v1.8.0 // indirect
82+
golang.org/x/crypto v0.37.0 // indirect
83+
golang.org/x/sys v0.36.0 // indirect
84+
google.golang.org/protobuf v1.36.8 // indirect
85+
gopkg.in/yaml.v3 v3.0.1 // indirect
86+
)

0 commit comments

Comments
 (0)