From cca6bdaf06a3e0f8a3d74fde2923168e44711b07 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20Koller?= <SxDx@users.noreply.github.com>
Date: Thu, 18 Oct 2018 15:47:21 +0200
Subject: [PATCH 1/7] Update Elixir example (#77)

Base.decode16!/2 only accepts uppercase strings as default so the elixir example does not work out of the box.
---
 examples/signature.ex | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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)

From d1329381f755c442d0d1086ad5bbbeb30ab03c7f Mon Sep 17 00:00:00 2001
From: Sergey Alexandrovich <DarthSim@users.noreply.github.com>
Date: Mon, 22 Oct 2018 13:20:20 +0600
Subject: [PATCH 2/7] Typo

---
 docs/healthcheck.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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.

From e163400864a4613a0f4c007bc419404dbb491f9c Mon Sep 17 00:00:00 2001
From: DarthSim <darthsim@gmail.com>
Date: Thu, 25 Oct 2018 20:22:29 +0600
Subject: [PATCH 3/7] Fix smart crop + brur/sharpen SIGSEGV on Alpine

---
 process.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/process.go b/process.go
index 6549594f..a74d2cd8 100644
--- a/process.go
+++ b/process.go
@@ -324,6 +324,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 {

From 6d09ab2cd88a4c7edbe98c1da166eb4b22f54874 Mon Sep 17 00:00:00 2001
From: Ricardson <ricardsonwilliams@gmail.com>
Date: Thu, 25 Oct 2018 11:28:17 -0300
Subject: [PATCH 4/7] Add multi-state build feature (#81)

* Add multi-state build

* add white space
---
 Dockerfile | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Dockerfile b/Dockerfile
index 83450c4a..3dc92bf2 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -16,6 +16,15 @@ RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/reposit
   && apk del --purge .build-deps \
   && rm -rf /var/cache/apk*
 
+FROM alpine:edge
+
+RUN \
+  && echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
+  && apk --no-cache add ca-certificates bash vips \
+  && rm -rf /var/cache/apk*
+
+COPY --from=0 /usr/local/bin/imgproxy /usr/local/bin
+
 CMD ["imgproxy"]
 
 EXPOSE 8080

From 29982e2d1a418b8bc17514e448ab50fb8fcb7e33 Mon Sep 17 00:00:00 2001
From: DarthSim <darthsim@gmail.com>
Date: Thu, 25 Oct 2018 22:25:54 +0600
Subject: [PATCH 5/7] Fix Dockerfile

---
 Dockerfile | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 3dc92bf2..1dcadfc1 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,15 +1,13 @@
 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 \
@@ -17,10 +15,11 @@ RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/reposit
   && 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 add ca-certificates bash vips \
+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

From 3ef568fa5cdbb0e9b13cc2faaa706e4a7fef125b Mon Sep 17 00:00:00 2001
From: DarthSim <darthsim@gmail.com>
Date: Thu, 25 Oct 2018 22:26:25 +0600
Subject: [PATCH 6/7] Bump version

---
 main.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/main.go b/main.go
index bcdb4bf2..5d8589c8 100644
--- a/main.go
+++ b/main.go
@@ -7,7 +7,7 @@ import (
 	_ "net/http/pprof"
 )
 
-const version = "2.0.1"
+const version = "2.0.2"
 
 type ctxKey string
 

From 2f7eeb9466059f226b83b80ef6f872a97fd4cf55 Mon Sep 17 00:00:00 2001
From: DarthSim <darthsim@gmail.com>
Date: Thu, 25 Oct 2018 22:27:57 +0600
Subject: [PATCH 7/7] Add Dockerfile and .dockerignore to .dockerignore

---
 .dockerignore | 3 +++
 1 file changed, 3 insertions(+)

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