Skip to content

Commit

Permalink
Create docker-image.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanno-bald authored Aug 23, 2024
1 parent 7fb27e9 commit a431f3c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI/CD Pipeline

on:
push:
branches:
- develop
- main

jobs:
build:
name: Build Docker Image
runs-on: ubuntu-latest
environment: ${{ github.ref == 'refs/heads/main' && 'production' || github.ref == 'refs/heads/develop' && 'development' }}
steps:
- name: Checkout code
uses: actions/[email protected]

- name: Set Environment Variables Based on Branch
run: |
echo "DOCKER_IMAGE=${{ vars.ACR }}/web-${{ vars.ENV }}" >> $GITHUB_ENV
- name: Build and push Docker image
run: |
cp .env.${{ vars.BRANCH_ENV }} .env
docker build -f Dockerfile -t ${{ env.DOCKER_IMAGE }}:latest -t ${{ env.DOCKER_IMAGE }}:$GITHUB_SHA .
echo "${{ env.DOCKER_IMAGE }}:$GITHUB_SHA"

0 comments on commit a431f3c

Please sign in to comment.