docker-build 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0e48e660810569e7042bdd70441872e8a1239c0
4
- data.tar.gz: b59a5093be2d4ef7f56fe5dc570a26e340037327
3
+ metadata.gz: c01b298aefd260a725ada099c64549de06bb72e9
4
+ data.tar.gz: 136772c23f5fdecf4beb0591f494fca179a5f56b
5
5
  SHA512:
6
- metadata.gz: 082810557438576acdcedfc5196deb59f428b4a9bfb1f0d98cd1814de8a1f1445488fa292c71227a359a783076795be8f51b757e56491d72c83963a7d0ccf361
7
- data.tar.gz: 8cc9ab966ba0cb3927170c0028b142a5931bbf25fc5d6e350f9dfaa010ecf5456db02d5ceba70e12d699c38e484742be469fb77c7ee364343b7b960b9aca715a
6
+ metadata.gz: 5bef3e66c3f4d92d5b8df5a60f523d536bcf80f9e2952f9a759fbc7a30003c32598209f03534d22d06d679a41d2820111e42acdb1a79ed649907bf64514903bb
7
+ data.tar.gz: 3275d18d980191b6ad4ad3b6e6d4207d8c3c27a9da77f1c306572d77f90d9fd3dce3ce319c01f0978a5309cfae6fe0303aa7ecf4aba7f43947f7bf595604161a
@@ -13,7 +13,7 @@ class DockerBuild
13
13
  end
14
14
 
15
15
  def self.data_container(docker_file_path)
16
- command = "docker build #{docker_file_path}"
16
+ command = "docker build --no-cache #{docker_file_path}"
17
17
  output = `#{command}`
18
18
 
19
19
  puts output
@@ -1,19 +1,27 @@
1
1
  class Google
2
2
 
3
- def self.tag_container(image_id, repo, project_id)
4
- time = Time.new
5
- image_timestamp = "#{time.year}-#{time.month}-#{time.day}_#{time.hour}#{time.min}#{time.sec}"
3
+ def self.tag_container(image_id, repo, project_id, cached=false)
6
4
  branch = `git rev-parse --abbrev-ref HEAD`.strip
7
- command = "docker tag #{image_id} #{repo}/#{project_id}:#{branch}-latest"
8
- puts command
9
- system command
10
- tag = "#{repo}/#{project_id}:#{branch}-#{image_timestamp}"
5
+ commit = `git rev-parse --short HEAD`.strip
6
+ tag = "#{repo}/#{project_id}:#{branch}-#{commit}-"
7
+ if cached
8
+ tag << 'cached'
9
+ else
10
+ tag << 'uncached'
11
+ end
11
12
  command = "docker tag #{image_id} #{tag}"
12
13
  puts command
13
14
  system command
14
15
  return tag
15
16
  end
16
17
 
18
+ def self.tag_latest(image_id, repo, project_id)
19
+ branch = `git rev-parse --abbrev-ref HEAD`.strip
20
+ command = "docker tag -f #{image_id} #{repo}/#{project_id}:#{branch}-latest"
21
+ puts command
22
+ system command
23
+ end
24
+
17
25
  def self.push_container(image_tag)
18
26
  command = "gcloud preview docker push #{image_tag}"
19
27
  fail "Could not push container: #{image_tag}" unless system(command)
@@ -4,6 +4,12 @@ class Symfony
4
4
  Doctrine
5
5
  end
6
6
 
7
+ def self.purge_cache(data_container)
8
+ puts `docker run --rm --volumes-from #{data_container} vjftw/data /bin/bash -l -c "mkdir -p app/cache"`
9
+ puts `docker run --rm --volumes-from #{data_container} vjftw/data /bin/bash -l -c "rm -rf app/cache/*"`
10
+ puts `docker run --rm --volumes-from #{data_container} vjftw/data /bin/bash -l -c "chmod -R 777 app/cache"`
11
+ end
12
+
7
13
  def self.run_command(data_container, command)
8
14
  docker_command = "docker run --rm --volumes-from #{data_container} vjftw/php-cli app/console --ansi #{command}"
9
15
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker-build
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - VJ Patel