Skip to content

Commit cba84c5

Browse files
Support podman in tasks/build.rake
Support podman in addition to docker in tasks/build.rake via the DOCKER environment variable. Signed-off-by: Greg NISBET <gregorynisbet@google.com>
1 parent bff9aac commit cba84c5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tasks/build.rake

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,27 +50,27 @@ DEP_BUILD_ORDER = [
5050
].freeze
5151

5252
def image_exists
53-
!`docker images -q #{@image}`.strip.empty?
53+
!`${DOCKER_BIN-docker} images -q #{@image} --format={{json .ID}}`.strip.empty?
5454
end
5555

5656
def container_exists
57-
!`docker container ls --all --filter 'name=#{@container}' --format '{{json .ID}}'`.strip.empty?
57+
!`${DOCKER_BIN-docker} container ls --all --filter 'name=#{@container}' --format '{{json .ID}}'`.strip.empty?
5858
end
5959

6060
def teardown
6161
if container_exists
6262
puts "Stopping #{@container}"
63-
run_command("docker stop #{@container}", silent: false, print_command: true)
64-
run_command("docker rm #{@container}", silent: false, print_command: true)
63+
run_command("${DOCKER_BIN-docker} stop #{@container}", silent: false, print_command: true)
64+
run_command("${DOCKER_BIN-docker} rm #{@container}", silent: false, print_command: true)
6565
end
6666
end
6767

6868
def start_container(ezbake_dir)
69-
run_command("docker run -d --name #{@container} -v .:/code -v #{ezbake_dir}:/deps #{@image} /bin/sh -c 'tail -f /dev/null'", silent: false, print_command: true)
69+
run_command("${DOCKER_BIN-docker} run -d --name #{@container} -v .:/code -v #{ezbake_dir}:/deps #{@image} /bin/sh -c 'tail -f /dev/null'", silent: false, print_command: true)
7070
end
7171

7272
def run(cmd)
73-
run_command("docker exec #{@container} /bin/bash --login -c '#{cmd}'", silent: false, print_command: true)
73+
run_command("${DOCKER_BIN-docker} exec #{@container} /bin/bash --login -c '#{cmd}'", silent: false, print_command: true)
7474
end
7575

7676
namespace :vox do
@@ -89,7 +89,7 @@ namespace :vox do
8989
# delete all containers and do `docker rmi ezbake-builder`
9090
unless image_exists
9191
puts "Building ezbake-builder image"
92-
run_command("docker build -t ezbake-builder .", silent: false, print_command: true)
92+
run_command("${DOCKER_BIN-docker} build -t ezbake-builder .", silent: false, print_command: true)
9393
end
9494

9595
libs_to_build_manually = {}

0 commit comments

Comments
 (0)