Skip to content

Fix: prometheus url 허용으로 수정 (#219) #128

Fix: prometheus url 허용으로 수정 (#219)

Fix: prometheus url 허용으로 수정 (#219) #128

Workflow file for this run

name: CD
on:
push:
branches:
- main
permissions:
contents: read
jobs:
cd:
runs-on: ubuntu-22.04
env:
IMAGE_TAG: ${{ github.sha }}
REPO: ${{ secrets.DOCKER_REPOSITORY }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
- name: Execute Gradle build
run: ./gradlew clean :bootBuildImage --imageName=$REPO:$IMAGE_TAG
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Publish Docker image
run: |
echo "Pushing Docker image with tag: $IMAGE_TAG"
docker push $REPO:$IMAGE_TAG
- name: Send command by AWS SSM
uses: peterkimzz/aws-ssm-send-command@master
id: ssm
with:
aws-region: ap-northeast-2
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
instance-ids: ${{ secrets.AWS_INSTANCE_ID }}
working-directory: ${{ vars.DEPLOY_SCRIPT_PATH }}
command: |
echo "############# PULL DOCKER IMAGE #############"
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}
docker pull ${{ env.REPO }}:${{ env.IMAGE_TAG }}
echo "############# RUN DEPLOY SCRIPT #############"
sh deploy.sh ${{ env.REPO }} ${{ env.IMAGE_TAG }}