diff --git a/.dockerignore b/.dockerignore index d0c8bf6b..f65b84bf 100644 --- a/.dockerignore +++ b/.dockerignore @@ -10,3 +10,6 @@ docs/ LICENSE README.md CHANGELOG.md + +Dockerfile +.dockerignore diff --git a/Dockerfile b/Dockerfile index 83450c4a..1dcadfc1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,29 @@ FROM alpine:edge -MAINTAINER Sergey Aleksandrovich +LABEL maintainer="Sergey Alexandrovich " 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 " + +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 diff --git a/docs/healthcheck.md b/docs/healthcheck.md index de191c18..c4edee1a 100644 --- a/docs/healthcheck.md +++ b/docs/healthcheck.md @@ -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. diff --git a/examples/signature.ex b/examples/signature.ex index 0cc9daa1..826489b2 100644 --- a/examples/signature.ex +++ b/examples/signature.ex @@ -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) diff --git a/main.go b/main.go index 2e409fae..7b7e67d9 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,7 @@ import ( _ "net/http/pprof" ) -const version = "2.0.1" +const version = "2.0.2" type ctxKey string diff --git a/process.go b/process.go index 7e432b01..b709d8bd 100644 --- a/process.go +++ b/process.go @@ -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 {