-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 더 이상 사용하지 않을 스크립트 파일 삭제 - appspec.yml 수정
- Loading branch information
Showing
3 changed files
with
38 additions
and
32 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,8 +33,7 @@ jobs: | |
${{ runner.os }}-gradle- | ||
- name: Grant execute permission for gradlew | ||
run: | ||
chmod +x gradlew | ||
run: chmod +x gradlew | ||
|
||
## create application-prod.yml | ||
- name: create application.yml | ||
|
@@ -48,22 +47,6 @@ jobs: | |
- name: Build with Gradle | ||
run: ./gradlew build -x test | ||
|
||
## docker build & push to production | ||
- name: Build Docker image | ||
run: docker build --tag acchotsix/acc-hotsix:latest . | ||
|
||
- name: Log in to DockerHub | ||
uses: docker/[email protected] | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Push image to DockerHub | ||
run: docker push acchotsix/acc-hotsix:latest | ||
|
||
- name: Make zip file | ||
run: zip -r ./hotsix.zip . | ||
|
||
## deploy to production | ||
- name: Configure AWS IAM credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
|
@@ -72,12 +55,37 @@ jobs: | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} | ||
aws-region: ap-northeast-2 | ||
|
||
- name: Login to ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
## docker build | ||
- name: build docker file and setting deploy files | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
ECR_REPOSITORY: acc6-ecr | ||
IMAGE_TAG: ${{ github.sha }} | ||
run: | | ||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | ||
mkdir scripts | ||
touch scripts/deploy.sh | ||
echo "aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin $ECR_REGISTRY" >> scripts/deploy.sh | ||
echo "docker pull $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> scripts/deploy.sh | ||
echo "docker run -p 8080:8080 -e PROFILE=dev -d --restart always --name csbroker-api $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> scripts/deploy.sh | ||
- name: Upload to S3 | ||
run: aws s3 cp --region ap-northeast-2 ./hotsix.zip s3://acc6-s3-dev-an2/hotsix.zip #버킷에 업로드. | ||
env: | ||
IMAGE_TAG: ${{ github.sha }} | ||
run: | | ||
zip -r deploy-$IMAGE_TAG.zip ./scripts appspec.yml | ||
aws s3 cp --region ap-northeast-2 --acl private ./deploy-$IMAGE_TAG.zip s3://acc6-s3-dev-an2 | ||
- name: Start CodeDeploy Agent | ||
run: > | ||
env: | ||
IMAGE_TAG: ${{ github.sha }} | ||
run: | | ||
aws deploy create-deployment --application-name hotsix | ||
--deployment-config-name CodeDeployDefault.AllAtOnce | ||
--deployment-group-name deploy-group | ||
--s3-location bucket=acc6-s3-dev-an2,bundleType=zip,key=hotsix.zip | ||
--s3-location bucket=acc6-s3-dev-an2,bundleType=zip,key=deploy-$IMAGE_TAG.zip |
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
This file was deleted.
Oops, something went wrong.