Merge pull request #55 from VentionCapstone/fix/search-refactor-isVal… #29
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: VENTION BOOKING CI (DEV) | |
on: | |
push: | |
branches: ['develop'] | |
env: | |
DOCKERHUB_IMAGE_NAME: vention-booking | |
DOCKER_CONTAINER_NAME: backend-server | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Login DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build, tag, and push docker image | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: ${{ secrets.DOCKER_USERNAME }}/${{env.DOCKERHUB_IMAGE_NAME}}:latest | |
- name: Rename docker compose config file | |
run: mv docker-compose.ci.yml docker-compose.yml | |
- name: Copy docker compose config file to EC2 | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.EC2_HOST_DEV }} | |
username: ${{ secrets.EC2_USERNAME }} | |
key: ${{ secrets.EC2_PRIVATE_KEY }} | |
port: ${{ secrets.EC2_PORT }} | |
source: 'docker-compose.yml' | |
target: /home/${{ secrets.EC2_USERNAME }} | |
- name: Login to EC2 instance | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.EC2_HOST_DEV }} | |
username: ${{ secrets.EC2_USERNAME }} | |
key: ${{ secrets.EC2_PRIVATE_KEY }} | |
port: ${{ secrets.EC2_PORT }} | |
script: | | |
docker compose down | |
docker compose rm -f ${{env.DOCKER_CONTAINER_NAME}} | |
docker compose pull ${{env.DOCKER_CONTAINER_NAME}} | |
docker compose up -d ${{env.DOCKER_CONTAINER_NAME}} |