allow non super users to view skill requests & filter out skill reque… #34
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 EC2 | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'staging' }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: skill-tree/Dockerfile | |
platforms: linux/arm64 | |
push: true | |
tags: | | |
${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:${{ github.sha }} | |
${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Deploy to EC2 | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.AWS_EC2_HOST }} | |
username: ${{ secrets.AWS_EC2_USERNAME }} | |
key: ${{ secrets.AWS_EC2_SSH_PRIVATE_KEY }} | |
script: | | |
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}:latest | |
docker stop ${{ github.event.repository.name }}-${{ vars.ENV }} || true | |
docker rm ${{ github.event.repository.name }}-${{ vars.ENV }} || true | |
docker run -d -p ${{ vars.PORT }}:8080 \ | |
--name ${{ github.event.repository.name }}-${{ vars.ENV }} \ | |
--network=${{ vars.DOCKER_NETWORK }} \ | |
-e RDS_PUBLIC_KEY="${{ secrets.RDS_PUBLIC_KEY }}" \ | |
-e MYSQL_HOST="${{ secrets.MYSQL_HOST }}" \ | |
-e MYSQL_PORT="${{ secrets.MYSQL_PORT }}" \ | |
-e DB_NAME="${{ vars.DB_NAME }}" \ | |
-e MYSQL_DB_USERNAME="${{ secrets.MYSQL_DB_USERNAME }}" \ | |
-e MYSQL_DB_PASSWORD="${{ secrets.MYSQL_DB_PASSWORD }}" \ | |
-e RDS_BACKEND_BASE_URL="${{ vars.RDS_BACKEND_BASE_URL }}" \ | |
-e SKILL_TREE_BACKEND_BASE_URL="${{ vars.SKILL_TREE_BACKEND_BASE_URL }}" \ | |
-e SKILL_TREE_FRONTEND_BASE_URL="${{ vars.SKILL_TREE_FRONTEND_BASE_URL }}" \ | |
-e SPRING_PROFILES_ACTIVE="${{ vars.SPRING_PROFILES_ACTIVE }}" \ | |
-e API_V1_PREFIX=/api/v1 \ | |
${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }} |