Changed Dockerfile

This commit is contained in:
Andreas Neue 2019-01-09 09:36:29 +01:00
parent 09c7df1091
commit 271590f775
2 changed files with 6 additions and 5 deletions

View File

@ -14,7 +14,8 @@ RUN wget https://github.com/libvips/libvips/releases/download/v8.7.3/vips-8.7.3.
cd vips-8.7.3 && \ cd vips-8.7.3 && \
./configure && \ ./configure && \
make && \ make && \
make install make install && \
go get -v -u github.com/davidbyttow/govips/pkg/vips && \
go install -v ./...
RUN go get -v -u github.com/davidbyttow/govips/pkg/vips CMD ["image-resizer", "-s", "https://images.example.com/"]
RUN go install -v ./...

View File

@ -28,7 +28,7 @@ func main() {
defer vips.Shutdown() defer vips.Shutdown()
http.HandleFunc("/", resizeHandler) http.HandleFunc("/", resizeHandler)
log.Fatal(http.ListenAndServe(listenAddr, nil)) log.Fatal(http.ListenAndServe(*listenAddr, nil))
} }
func resizeHandler(w http.ResponseWriter, r *http.Request) { func resizeHandler(w http.ResponseWriter, r *http.Request) {
@ -67,7 +67,7 @@ func resizeHandler(w http.ResponseWriter, r *http.Request) {
} }
// Start fetching the image from the given url // Start fetching the image from the given url
resp, err := http.Get(imgServer + queryUrl) resp, err := http.Get(*imgServer + queryUrl)
if err != nil { if err != nil {
w.Write([]byte(fmt.Sprintf("failed to get %s: %v", queryUrl, err))) w.Write([]byte(fmt.Sprintf("failed to get %s: %v", queryUrl, err)))
w.WriteHeader(http.StatusBadRequest) w.WriteHeader(http.StatusBadRequest)