Skip to content

update docker image #34

update docker image

update docker image #34

name: Github Action Todo App
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build_and_deploy:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./
strategy:
matrix:
node-version:
- 16.x
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: ${{ github.workspace }}/package-lock.json
- run: npm install
- name: Build Docker Image
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
run: |
docker build \
-t todo-app-docker \
.
docker tag todo-app-docker:latest nguyenvanhuan243/todo-app-docker:latest
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push Docker Image
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
docker push nguyenvanhuan243/todo-app-docker:latest
- name: Trigger Docker Container on Render Server
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
curl -X GET https://api.render.com/deploy/srv-cobolp5jm4es739sr6u0?key=QhjaaRuXzow
curl -X GET https://api.netlify.com/build_hooks/6617a0d0d2eb2161ac37eaf9