Skip to content

fix: 회원가입시 중복 아이디 불가하게 설정 #89

fix: 회원가입시 중복 아이디 불가하게 설정

fix: 회원가입시 중복 아이디 불가하게 설정 #89

Workflow file for this run

name: Build and Deploy
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'
# 환경 변수 설정
- name: Make application.properties
run: |
cd ./src/main/resources
touch ./application.properties
echo "${{ secrets.APPLICATION_PROPERTIES }}" > ./application.properties
shell: bash
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew build -x test
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push Docker image
run: |
docker build -t ${{ secrets.DOCKERHUB_REPOSITORY }} -f ./Dockerfile .
docker tag ${{ secrets.DOCKERHUB_REPOSITORY }} ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPOSITORY }}:${{ github.sha }}
docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPOSITORY }}:${{ github.sha }}
- name: Deploy to EC2
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
echo "Starting deployment..."
cd ~/midpoint-backend
echo "Pulling latest changes from main branch..."
git pull origin main
echo "Pulling latest Docker image..."
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPOSITORY }}:${{ github.sha }}
echo "Setting environment variables..."
echo "POSTGRES_DB=${{ secrets.POSTGRES_DB }}" > .env
echo "POSTGRES_USER=${{ secrets.POSTGRES_USER }}" >> .env
echo "POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}" >> .env
echo "DOCKER_IMAGE=${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPOSITORY }}:${{ github.sha }}" >> .env
echo "Starting Docker containers with docker-compose..."
docker-compose --env-file .env up -d
echo "Deployment completed successfully!"
timeout: 60m