mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-03-17 20:17:48 +02:00
Merge branch 'master' into version/2.1
This commit is contained in:
commit
c2395ef5af
@ -10,3 +10,6 @@ docs/
|
||||
LICENSE
|
||||
README.md
|
||||
CHANGELOG.md
|
||||
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
|
16
Dockerfile
16
Dockerfile
@ -1,21 +1,29 @@
|
||||
FROM alpine:edge
|
||||
MAINTAINER Sergey Aleksandrovich <darthsim@gmail.com>
|
||||
LABEL maintainer="Sergey Alexandrovich <darthsim@gmail.com>"
|
||||
|
||||
ENV GOPATH /go
|
||||
ENV PATH /usr/local/go/bin:$PATH
|
||||
|
||||
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
|
||||
|
||||
ADD . /go/src/github.com/DarthSim/imgproxy
|
||||
|
||||
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
|
||||
&& apk add --no-cache --update bash vips ca-certificates \
|
||||
&& apk --no-cache upgrade \
|
||||
&& apk add --no-cache --virtual .build-deps go gcc musl-dev fftw-dev vips-dev \
|
||||
&& cd /go/src/github.com/DarthSim/imgproxy \
|
||||
&& CGO_LDFLAGS_ALLOW="-s|-w" go build -v -o /usr/local/bin/imgproxy \
|
||||
&& apk del --purge .build-deps \
|
||||
&& rm -rf /var/cache/apk*
|
||||
|
||||
FROM alpine:edge
|
||||
LABEL maintainer="Sergey Alexandrovich <darthsim@gmail.com>"
|
||||
|
||||
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
|
||||
&& apk --no-cache upgrade \
|
||||
&& apk add --no-cache ca-certificates bash vips \
|
||||
&& rm -rf /var/cache/apk*
|
||||
|
||||
COPY --from=0 /usr/local/bin/imgproxy /usr/local/bin
|
||||
|
||||
CMD ["imgproxy"]
|
||||
|
||||
EXPOSE 8080
|
||||
|
@ -4,4 +4,4 @@ imgproxy comes with a built-in health check HTTP endpoint at `/health`.
|
||||
|
||||
`GET /health` returns HTTP Status `200 OK` if the server is started successfully.
|
||||
|
||||
You can use this for readiness/liveness probe in when deploying with a container orchestration system such as Kubernetes.
|
||||
You can use this for readiness/liveness probe when deploying with a container orchestration system such as Kubernetes.
|
||||
|
@ -1,7 +1,7 @@
|
||||
defmodule App.Imgproxy do
|
||||
@prefix "https://imgproxy.mybiz.xyz"
|
||||
@key Base.decode16!("943b421c9eb07c830af81030552c86009268de4e532ba2ee2eab8247c6da0881")
|
||||
@salt Base.decode16!("520f986b998545b4785e0defbc4f3c1203f22de2374a3d53cb7a7fe9fea309c5")
|
||||
@key Base.decode16!("943b421c9eb07c830af81030552c86009268de4e532ba2ee2eab8247c6da0881", case: :lower)
|
||||
@salt Base.decode16!("520f986b998545b4785e0defbc4f3c1203f22de2374a3d53cb7a7fe9fea309c5", case: :lower)
|
||||
|
||||
def build_url(img_url, opts) do
|
||||
path = build_path(img_url, opts)
|
||||
|
2
main.go
2
main.go
@ -8,7 +8,7 @@ import (
|
||||
_ "net/http/pprof"
|
||||
)
|
||||
|
||||
const version = "2.0.1"
|
||||
const version = "2.0.2"
|
||||
|
||||
type ctxKey string
|
||||
|
||||
|
@ -341,6 +341,11 @@ func processImage(ctx context.Context) ([]byte, error) {
|
||||
if err = vipsSmartCrop(&img, po.Width, po.Height); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Applying additional modifications after smart crop causes SIGSEGV on Alpine
|
||||
// so we have to copy memory after it
|
||||
if err = vipsImageCopyMemory(&img); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
left, top := calcCrop(imgWidth, imgHeight, po)
|
||||
if err = vipsCrop(&img, left, top, po.Width, po.Height); err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user