Changed Dockerfile
This commit is contained in:
parent
09c7df1091
commit
271590f775
|
@ -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 ./...
|
|
||||||
|
|
4
main.go
4
main.go
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue