Skip to content

Commit

Permalink
Merge pull request #1756 from Mohmn/feat/build-mutiple-docker-images-…
Browse files Browse the repository at this point in the history
…in-dev

feat: build multiple docker images for multiple envs
  • Loading branch information
Mohmn authored Feb 16, 2024
2 parents 68c9340 + a0cdafa commit d646dc8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-main-channel-to-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Use Node.js 18.x
uses: actions/setup-node@v1
with:
node-version: '18.x'
node-version: '20.x'
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@master
Expand Down
41 changes: 25 additions & 16 deletions .github/workflows/dev-build-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,38 +50,47 @@ jobs:
working-directory: ${{ env.project-directory }}
env:
NODE_ENV: production
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- id: export_bumped_version
run: |
export BUMPED_VERSION="${{ steps.package-version.outputs.current-version }}"
echo "bumped_version=${BUMPED_VERSION}" >> $GITHUB_OUTPUT
outputs:
bumped_version: ${{ steps.export_bumped_version.outputs.bumped_version }}

# todo add test image here
# since test api is throwing some error that is why i excluded that
build-and-push-docker:
name: Build and Push Docker Images
runs-on: ubuntu-latest
needs: release
strategy:
matrix:
include:
- dockerfile: ./Dockerfile-dev
image_name: greenstand/${{ github.event.repository.name }}-dev:${{ needs.release.outputs.bumped_version }}
- dockerfile: ./Dockerfile
image_name: greenstand/${{ github.event.repository.name }}:${{ needs.release.outputs.bumped_version }}
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build snapshot and push on merge
id: docker_build_release
- name: Build and push
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile-dev
file: ${{ matrix.dockerfile }}
push: true
tags: greenstand/${{ github.event.repository.name }}-dev:${{ steps.package-version.outputs.current-version }}

- id: export_bumped_version
run: |
export BUMPED_VERSION="${{ steps.package-version.outputs.current-version }}"
echo "bumped_version=${BUMPED_VERSION}" >> $GITHUB_OUTPUT
outputs:
bumped_version: ${{ steps.export_bumped_version.outputs.bumped_version }}
tags: ${{ matrix.image_name }}

deploy:
name: Deploy to dev
runs-on: ubuntu-latest
needs: release
needs: build-and-push-docker
steps:
- uses: actions/checkout@v2
with:
Expand Down

0 comments on commit d646dc8

Please sign in to comment.