tested all account route in account.test.js #232
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: Deploy to Docker | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Build and push API image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./backend | |
file: ./backend/Dockerfile | |
push: true | |
tags: kovacevicaleksa/express-api:latest | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new | |
- name: Build and push Nginx image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./backend | |
file: ./backend/Dockerfile.nginx | |
push: true | |
tags: kovacevicaleksa/express-nginx:latest | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new | |
- name: Build and push Frontend image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./frontend | |
file: ./frontend/Dockerfile.frontend | |
push: true | |
tags: kovacevicaleksa/react-frontend:latest | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new | |
# Move cache | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
- name: Image digest | |
run: | | |
echo "API image digest: $(docker inspect kovacevicaleksa/express-api:latest --format='{{index .RepoDigests 0}}')" | |
echo "Nginx image digest: $(docker inspect kovacevicaleksa/express-nginx:latest --format='{{index .RepoDigests 0}}')" | |
echo "Frontend image digest: $(docker inspect kovacevicaleksa/react-frontend:latest --format='{{index .RepoDigests 0}}')" |