Skip to content

push docker image to dockerhub #23

push docker image to dockerhub

push docker image to dockerhub #23

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
release:
types: [published]
jobs:
backend-build:
runs-on: ubuntu-latest
steps:
- name: Checkout backend code
uses: actions/checkout@v3
- name: Build and push the Docker image for backend
run: |
docker build ./backend -t my-docker-hub-namespace/backend-image-name:$(date +%s)
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
docker push my-docker-hub-namespace/backend-image-name:$(date +%s)
frontend-build:
runs-on: ubuntu-latest
steps:
- name: Checkout frontend code
uses: actions/checkout@v3
- name: Build and push the Docker image for frontend
run: |
docker build ./frontend -t my-docker-hub-namespace/frontend-image-name:$(date +%s)
echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
docker push my-docker-hub-namespace/frontend-image-name:$(date +%s)