From 99379a3e15ca2d9e1ea0b574be8d51244e422cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 1 Aug 2024 22:48:34 +0200 Subject: [PATCH] Do it in one step --- .github/workflows/ubuntu.yml | 9 ++------- tasks/docker.rake | 30 ++++++++++-------------------- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 96bf03e3..5df7df8a 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -29,13 +29,8 @@ jobs: ruby-version: 3.3.3 bundler-cache: true - - name: Build docker image - run: bin/rake docker:build[${{ matrix.version }},${{ matrix.line_editor }},${{ matrix.compiler }}] - - - name: Push docker image - run: bin/rake docker:push[${{ matrix.version }},${{ matrix.line_editor }},${{ matrix.compiler }}] - env: - DOCKER_PASS: ${{ secrets.DOCKER_PASS }} + - name: Build and push docker image + run: bin/rake docker:build_and_push[${{ matrix.version }},${{ matrix.line_editor }},${{ matrix.compiler }}] test: container: deividrodriguez/byebug:${{ matrix.version }}-${{ matrix.line_editor }}-${{ matrix.compiler }} diff --git a/tasks/docker.rake b/tasks/docker.rake index 2e07ecca..05f7df0c 100644 --- a/tasks/docker.rake +++ b/tasks/docker.rake @@ -9,25 +9,27 @@ namespace :docker do end desc "Build the default docker image" - task :build_default do + task :build do Docker::Manager.build_default end - desc "Builds a docker image" - task :build, %i[version line_editor compiler] do |_t, opts| + desc "Build a ruby trunk image" + task :build_and_push_head, %i[line_editor compiler] do |_t, opts| manager = Docker::Manager.new( - version: opts[:version], + version: "head", line_editor: opts[:line_editor], compiler: opts[:compiler] ) manager.build + manager.login + manager.push end - desc "Build a ruby trunk image" - task :build_and_push_head, %i[line_editor compiler] do |_t, opts| + desc "Build and push an image" + task :build_and_push, %i[version line_editor compiler] do |_t, opts| manager = Docker::Manager.new( - version: "head", + version: opts[:version], line_editor: opts[:line_editor], compiler: opts[:compiler] ) @@ -53,19 +55,7 @@ namespace :docker do end desc "Push the default docker image to dockerhub" - task :push_default do + task :push do Docker::Manager.push_default end - - desc "Pushes a docker image" - task :push, %i[version line_editor compiler] do |_t, opts| - manager = Docker::Manager.new( - version: opts[:version], - line_editor: opts[:line_editor], - compiler: opts[:compiler] - ) - - manager.login - manager.push - end end