forked from vieter-v/vieter
Fully functional hardcoded build command
This commit is contained in:
parent
4f705f5fb5
commit
941b30e7d2
5 changed files with 65 additions and 24 deletions
|
|
@ -37,7 +37,32 @@ pub fn create_container(c &NewContainer) ?string {
|
|||
|
||||
pub fn start_container(id string) ?bool {
|
||||
res := request('POST', urllib.parse('/containers/$id/start') ?) ?
|
||||
println(res)
|
||||
|
||||
return res.status_code == 204
|
||||
}
|
||||
|
||||
struct ContainerInspect {
|
||||
pub:
|
||||
state ContainerState [json: State]
|
||||
}
|
||||
|
||||
struct ContainerState {
|
||||
pub:
|
||||
running bool [json: Running]
|
||||
}
|
||||
|
||||
pub fn inspect_container(id string) ?ContainerInspect {
|
||||
res := request('GET', urllib.parse('/containers/$id/json') ?) ?
|
||||
|
||||
if res.status_code != 200 {
|
||||
return error("Failed to inspect container.")
|
||||
}
|
||||
|
||||
return json.decode(ContainerInspect, res.text)
|
||||
}
|
||||
|
||||
pub fn remove_container(id string) ?bool {
|
||||
res := request('DELETE', urllib.parse('/containers/$id') ?) ?
|
||||
|
||||
return res.status_code == 204
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,6 @@ pub fn request_with_json<T>(method string, url urllib.URL, data &T) ?http.Respon
|
|||
return request_with_body(method, url, 'application/json', body)
|
||||
}
|
||||
|
||||
pub fn pull(image string, tag string) ?http.Response {
|
||||
pub fn pull_image(image string, tag string) ?http.Response {
|
||||
return request('POST', urllib.parse('/images/create?fromImage=$image&tag=$tag') ?)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue