Merge branch 'develop' of https://github.com/vectornguyen76/search-en… #105
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: development | |
on: | |
pull_request: | |
branches: develop | |
push: | |
branches: | |
- develop | |
jobs: | |
build-push-image-search: | |
runs-on: ubuntu-latest | |
env: | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Cache Python dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('./image-search-engine/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip-image-search | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install Dependencies | |
run: pip install -r ./image-search-engine/requirements.txt | |
- name: Run isort | |
run: isort --check-only ./image-search-engine/. | |
- name: Run black | |
run: black --check ./image-search-engine/. | |
- name: Run flake8 | |
run: flake8 --ignore=E501,W503,F401 ./image-search-engine | |
# - name: Run Pylint | |
# run: pylint ./image-search-engine/*.py | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
id: docker_hub_auth | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./image-search-engine | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/image-search-engine:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-push-text-search: | |
runs-on: ubuntu-latest | |
env: | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Cache Python dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('./text-search-engine/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip-text-search | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install Dependencies | |
run: pip install -r ./text-search-engine/requirements.txt | |
- name: Run isort | |
run: isort --check-only ./text-search-engine/. | |
- name: Run black | |
run: black --check ./text-search-engine/. | |
- name: Run flake8 | |
run: flake8 --ignore=E501,W503,F401 ./text-search-engine | |
# - name: Run Pylint | |
# run: pylint ./image-search-engine/*.py | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
id: docker_hub_auth | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./text-search-engine | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/text-search-engine:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-push-frontend: | |
runs-on: ubuntu-latest | |
env: | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
id: docker_hub_auth | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Build and push dev frontend image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./frontend | |
file: ./frontend/Dockerfile.dev | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/frontend_dev_image:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Build and push prod frontend image | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./frontend | |
file: ./frontend/Dockerfile | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/frontend_prod_image:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |