Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: build multiple docker images for multiple envs #1756

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading