1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use tokio::process::Command;

pub async fn process_docker_build(project_id: &str, service_name: &str) {
  let gcr_url = String::from("eu.gcr.io/") + project_id + "/" + service_name;
  let output = Command::new("docker")
    .args(&["build", ".", "-t", &gcr_url])
    .output()
    .await;
  println!("output = {:?}", output);
}

pub async fn process_docker_push(project_id: &str, service_name: &str) {
  let gcr_url = String::from("eu.gcr.io/") + project_id + "/" + service_name;
  let output = Command::new("docker")
    .args(&["push", &gcr_url])
    .output()
    .await;
  println!("output = {:?}", output);
}

pub async fn process_docker_psql() {
  let output = Command::new("docker")
    .args(&[
      "run",
      "--rm",
      "-d",
      "--name",
      "epics-psql",
      "-p",
      "5432:5432",
      "-v",
      "postgres-tmp:/var/lib/postgresql/data",
      "-e",
      "POSTGRES_USER=postgres",
      "-e",
      "POSTGRES_PASSWORD=postgres",
      "-e",
      "POSTGRES_DB=epics_test",
      "postgres:14.2-alpine",
    ])
    .output()
    .await;
  println!("output = {:?}", output);
}