fix: CORS allowCredentials false 처리(2)( #25
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: CI/CD using github actions & docker | |
on: | |
push: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
CI-CD: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Gradle Caching | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: make application-deploy.properties | |
run: | | |
if [ ! -d "./src/main/resources" ]; then | |
mkdir -p ./src/main/resources | |
fi | |
echo "${{ secrets.YML_DEPLOY }}" > ./src/main/resources/application-deploy.properties | |
shell: bash | |
- name: (1) Build with Gradle | |
run: ./gradlew clean build -x test | |
- name: (2) AWS ECR 로그인 | |
run: | | |
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws configure set region ${{ secrets.AWS_REGION }} | |
aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.ECR_REPOSITORY }} | |
- name: (3) Docker Build & Push to AWS ECR | |
run: | | |
docker build --platform linux/amd64 -t scholarzip-server . | |
docker tag scholarzip-server:latest ${{ secrets.ECR_REPOSITORY }}:latest | |
docker push ${{ secrets.ECR_REPOSITORY }}:latest | |
- name: (4) Deploy to EC2 | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.EC2_HOST }} | |
username: ubuntu | |
key: ${{ secrets.EC2_SSH_KEY }} | |
script: | | |
cd scholarzip-server | |
docker compose pull | |
docker compose up -d --build |