update config #135
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker CI/CD | |
on: | |
push: | |
branches: [ "dev" ] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME_BACKEND: ${{ github.repository }}-backend | |
IMAGE_NAME_FRONTEND: ${{ github.repository }}-frontend | |
jobs: | |
prettier: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Prettify Code | |
uses: actionsx/prettier@v2 | |
with: | |
args: --write . | |
build-backend: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Log in to the Container registry | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Build and push Backend Docker image | |
- name: Build and push docker images | |
run: | | |
docker build --pull -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BACKEND }}:latest -f backend.Dockerfile . | |
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BACKEND }}:latest | |
build-frontend: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Log in to the Container registry | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Build and push Frontend Docker image | |
- name: Build and push docker images | |
run: | | |
docker build --pull -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_FRONTEND }}:latest -f frontend.Dockerfile . | |
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_FRONTEND }}:latest |