chore: 구매 링크 api 수정 #96
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 Development Server | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# branch 현재 비어있는 ubuntu에 내려받기 | |
- name: checkout | |
uses: actions/checkout@v3 | |
# java 다운받기 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Build with Gradle | |
run: | | |
chmod +x ./gradlew | |
./gradlew bootJar | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Docker Image Build and Push | |
run: | | |
docker build -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_SERVER }} . | |
docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_SERVER }} | |
docker build -f dockerfile-nginx -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_NGINX }} . | |
docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_NGINX }} | |
- name: Deploy to EC2 | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ubuntu | |
key: ${{ secrets.KEY }} | |
script: | | |
cd /home/ubuntu/ | |
sudo touch .env | |
echo "${{ secrets.ENV_VARS }}" | sudo tee .env > /dev/null | |
sudo touch docker-compose.yml | |
echo "${{ secrets.DOCKER_COMPOSE }}" | sudo tee docker-compose.yml > /dev/null | |
sudo chmod 666 /var/run/docker.sock | |
sudo docker rm -f $(sudo docker ps -qa) | |
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_SERVER }} | |
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_NGINX }} | |
docker-compose -f docker-compose.yml --env-file ./.env up -d | |
docker image prune -f |