Skip to content

Commit

Permalink
refactor(ci/cd) Update main.yml with docker job
Browse files Browse the repository at this point in the history
  • Loading branch information
Uj5Ghare authored Dec 8, 2024
1 parent e188942 commit 0c5aacb
Showing 1 changed file with 44 additions and 20 deletions.
64 changes: 44 additions & 20 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,52 @@ name: DevOps Engineer Assignment Workflow
on:
push:
branches: [main, dev]

pull_request:

defaults:
run:
shell: bash

jobs:
Build:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash
working-directory: ./frontend
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
refs: ${{ github.refs_name }}
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '14.21.3'
- name: Install dependencies
run: npm install
- name: Create production build folder
run: npm run build --if-present
# Build:
# runs-on: ubuntu-22.04
# defaults:
# run:
# shell: bash
# working-directory: ./frontend
# steps:
# - name: Checkout Code
# uses: actions/checkout@v4
# with:
# refs: ${{ github.refs_name }}
# - name: Setup node
# uses: actions/setup-node@v4
# with:
# node-version: '14.21.3'
# - name: Install dependencies
# run: npm install
# - name: Create production build folder
# run: npm run build --if-present

Docker:
runs-on: ubuntu-24.04
defaults:
run:
shell: bash
working-directory: ./frontend
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./frontend
push: true
tags: ${{ vars.DOCKER_USER }}/eng-frontend:${{ github.run_number }}

0 comments on commit 0c5aacb

Please sign in to comment.