Created
May 31, 2017 16:45
-
-
Save Proximyst/bcf7dff205eaeb3d12482b8b32a5ddae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:14.04 | |
WORKDIR /data | |
ENTRYPOINT \ | |
./Runner.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"fmt" | |
"os" | |
"log" | |
"net/http" | |
"io" | |
) | |
var ( | |
Url string | |
FileName string | |
) | |
func init() { | |
flag.StringVar(&Url, "url", "", "The URL to download from.") | |
flag.StringVar(&FileName, "file", "file", "The file to download to.") | |
flag.Parse() | |
} | |
func main() { | |
downloaded := download(FileName, Url) | |
if !downloaded { | |
fmt.Println("Couldn't download the file!") | |
os.Exit(1) | |
return | |
} | |
fmt.Println("Downloaded the file to", FileName) | |
} | |
func download(filename, dl string) bool { | |
file, err := os.Create(filename) | |
fmt.Println("Tried creating", filename) | |
if err != nil { | |
fmt.Println("Couldn't create. Statting.") | |
_, err := os.Stat(filename) | |
if os.IsNotExist(err) { | |
log.Fatal(err) | |
} | |
fmt.Println("Created anyways, it seems.") | |
} | |
defer file.Close() | |
// File now exists. | |
resp, err := http.Get(dl) | |
fmt.Println("Trying to download!") | |
if err != nil { | |
log.Fatal(err) | |
} | |
defer resp.Body.Close() | |
bytes, err := io.Copy(file, resp.Body) | |
fmt.Println("Trying to copy!") | |
if err != nil { | |
log.Fatal(err) | |
} | |
fmt.Println("Successfully copied", bytes, "bytes in total!") | |
return true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
./Downloader -file CoalesceBot.jar -url "http://vpswithjenkins/job/CoalesceBot/lastSuccessfulBuild/artifact/target/CoalesceBot.jar" | |
tools/java/bin/java -Xms64M -Xmx96M -jar CoalesceBot.jar bot-token github-token |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment