Skip to content

Commit

Permalink
[CI/CD] 최신 코드를 빌드하지 못 하는 이슈 해결 (#43)
Browse files Browse the repository at this point in the history
* cicd : 새로운 컨테이너 생성

* cicd : 새로운 컨테이너 생성

* cicd : 새로운 컨테이너 생성

* cicd : git actions 수정

* cicd : git actions 수정

* cicd : git actions 수정

* cicd : git actions 수정

* cicd : git actions 수정

* cicd : git actions 수정

* cicd : git actions 수정

* cicd : git actions 수정

* cicd : git actions 수정

* cicd : git actions 수정
  • Loading branch information
cowboysj authored Nov 14, 2024
1 parent 2d9f365 commit b60a4da
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 29 deletions.
38 changes: 10 additions & 28 deletions .github/workflows/dev-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ on:
push:
branches: [ "develop" ]

env:
DOCKERHUB_IMAGE_NAME: gigedi-server

jobs:

build-deploy:
runs-on: ubuntu-latest
environment: DEV

steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down Expand Up @@ -45,34 +44,17 @@ jobs:

- name: Extract Docker metadata
id: metadata
uses: docker/metadata-action@v5.5.0
uses: docker/metadata-action@v4
with:
images: ${{ secrets.DOCKER_USERNAME }}/${{ env.DOCKERHUB_IMAGE_NAME }}
images: ${{ secrets.DOCKER_USERNAME }}/shoot
tags: |
type=sha,prefix=
type=ref,event=branch
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.metadata.outputs.tags }}
run: |
docker build . -t ${{ secrets.DOCKER_USERNAME }}/shoot:latest
docker push ${{ secrets.DOCKER_USERNAME }}/shoot:latest
# - name: Create .env file from GitHub Secrets
# run: |
# echo "${{ secrets.ENV_FILE }}" > .env
#
# - name: Copy .env and docker-compose.yml to EC2
# uses: appleboy/scp-action@master
# with:
# host: ${{ secrets.AWS_EC2_IP }}
# username: ${{ secrets.AWS_EC2_USER }}
# key: ${{ secrets.AWS_EC2_SSH_KEY }}
# source: |
# .env
# docker-compose.yml
# target: "/home/ubuntu/"
# port: 22
- name: Deploy on EC2
uses: appleboy/ssh-action@master
Expand All @@ -83,6 +65,6 @@ jobs:
port: 22
script: |
cd /home/ubuntu
sudo docker pull cowboysj/shoot:latest
docker pull ${{ secrets.DOCKER_USERNAME }}/shoot:latest
docker-compose down
docker-compose up -d
docker-compose up -d
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=linux/amd64 openjdk:17-jdk-alpine
FROM openjdk:17-jdk-alpine
WORKDIR /app
COPY build/libs/*.jar app.jar
ENTRYPOINT ["java", "-jar", "app.jar"]
Expand Down

0 comments on commit b60a4da

Please sign in to comment.