Skip to content

fix: cors config

fix: cors config #19

Workflow file for this run

name: SB CI/CD with Gradle
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 1) Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: 2) Convert to prod config (env)
run: |
cd ./src/main/resources
touch ./application-prod.yml
echo "${{ secrets.APPLICATION_PROD }}" > ./application-prod.yml
- name: 4) Grant permission
run: chmod +x ./gradlew
- name: 5) Build with Gradle
run: ./gradlew clean build
- name: 6) Build docker and push
run: |
docker login -u ${{secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD}}
docker build --platform linux/amd64 -t ${{ secrets.DOCKER_REPO }} .
docker push ${{ secrets.DOCKER_REPO }}
- name: 7) SSH conn and run docker(deployment)
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_KEY }}
port: 22
script: |
sudo docker stop ${{ secrets.SERVER_NAME }}
sudo docker rm ${{ secrets.SERVER_NAME }}
sudo docker rmi ${{ secrets.DOCKER_REPO }}
sudo docker pull ${{ secrets.DOCKER_REPO }}
docker run -e SPRING_PROFILES_ACTIVE=prod --name ${{ secrets.SERVER_NAME }} -p 8080:8080 -d ${{ secrets.DOCKER_REPO }}