Browse Source

Deploy to Heroku without custom buildpack

DarthSim 7 years ago
parent
commit
5a46f542c6
3 changed files with 9 additions and 3 deletions
  1. 2 0
      Aptfile
  2. 2 3
      app.json
  3. 5 0
      config.go

+ 2 - 0
Aptfile

@@ -0,0 +1,2 @@
+:repo:deb http://ppa.launchpad.net/dhor/myway/ubuntu xenial main
+libvips-dev

+ 2 - 3
app.json

@@ -17,8 +17,7 @@
     }
     }
   },
   },
   "buildpacks": [
   "buildpacks": [
-    {
-      "url": "https://github.com/DarthSim/heroku-buildpack-imgproxy"
-    }
+    { "url": "https://github.com/heroku/heroku-buildpack-apt" },
+    { "url": "https://github.com/heroku/heroku-buildpack-go" }
   ]
   ]
 }
 }

+ 5 - 0
config.go

@@ -4,6 +4,7 @@ import (
 	"bytes"
 	"bytes"
 	"encoding/hex"
 	"encoding/hex"
 	"flag"
 	"flag"
+	"fmt"
 	"io/ioutil"
 	"io/ioutil"
 	"log"
 	"log"
 	"os"
 	"os"
@@ -96,6 +97,10 @@ func init() {
 	saltpath := flag.String("saltpath", "", "path of the file with hex-encoded salt")
 	saltpath := flag.String("saltpath", "", "path of the file with hex-encoded salt")
 	flag.Parse()
 	flag.Parse()
 
 
+	if port := os.Getenv("PORT"); len(port) > 0 {
+		conf.Bind = fmt.Sprintf(":%s", port)
+	}
+
 	strEnvConfig(&conf.Bind, "IMGPROXY_BIND")
 	strEnvConfig(&conf.Bind, "IMGPROXY_BIND")
 	intEnvConfig(&conf.ReadTimeout, "IMGPROXY_READ_TIMEOUT")
 	intEnvConfig(&conf.ReadTimeout, "IMGPROXY_READ_TIMEOUT")
 	intEnvConfig(&conf.WriteTimeout, "IMGPROXY_WRITE_TIMEOUT")
 	intEnvConfig(&conf.WriteTimeout, "IMGPROXY_WRITE_TIMEOUT")