From e56239527c9c294be2786bfd069890371019beeb Mon Sep 17 00:00:00 2001 From: Zakaria Fatahi Date: Mon, 21 Nov 2022 23:23:03 +0100 Subject: [PATCH 1/3] Add workflows/docker_image.yml file --- .github/workflows/docker_image.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/docker_image.yml diff --git a/.github/workflows/docker_image.yml b/.github/workflows/docker_image.yml new file mode 100644 index 0000000..9b3de97 --- /dev/null +++ b/.github/workflows/docker_image.yml @@ -0,0 +1,25 @@ +name: CI +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + # This job is used to build the Docker image and uses the Dockerfile and .env file + # from the root of the project. + build-and-publish-latest: + runs-on: ubuntu-latest + # if: github.ref == 'refs/heads/master' # Running this job only for master branch + + steps: + - name: Checkout code + uses: actions/checkout@v3 # Checking out the repo + + - name: Build and Publish latest Docker image + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + push: false + tags: my-app:latest From 76cb2ee829853743b9a4d8d9854378e69eb3f8fa Mon Sep 17 00:00:00 2001 From: Zakaria Fatahi Date: Mon, 21 Nov 2022 23:27:17 +0100 Subject: [PATCH 2/3] Add build-args --- .github/workflows/docker_image.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker_image.yml b/.github/workflows/docker_image.yml index 9b3de97..89c6d48 100644 --- a/.github/workflows/docker_image.yml +++ b/.github/workflows/docker_image.yml @@ -21,5 +21,9 @@ jobs: with: context: . file: ./Dockerfile - push: false - tags: my-app:latest + push: true + build-args: | + RAILS_ENV="production" + RUBY_VERSION="3.1.2" + NODE_VERSION="16.17.1-r0" + YARN_VERSION="1.22.19-r0" From a4b78ca60a0bac33742c3f05adb2027955a43d5f Mon Sep 17 00:00:00 2001 From: Zakaria Fatahi Date: Mon, 21 Nov 2022 23:28:57 +0100 Subject: [PATCH 3/3] Add tags --- .github/workflows/docker_image.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker_image.yml b/.github/workflows/docker_image.yml index 89c6d48..de4de94 100644 --- a/.github/workflows/docker_image.yml +++ b/.github/workflows/docker_image.yml @@ -22,8 +22,9 @@ jobs: context: . file: ./Dockerfile push: true + tags: baseapp:latest build-args: | - RAILS_ENV="production" - RUBY_VERSION="3.1.2" - NODE_VERSION="16.17.1-r0" - YARN_VERSION="1.22.19-r0" + RAILS_ENV=production + RUBY_VERSION=3.1.2 + NODE_VERSION=16.17.1-r0 + YARN_VERSION=1.22.19-r0