Skip to content

Commit

Permalink
🌐 [Ci]: base 이미지 캐싱
Browse files Browse the repository at this point in the history
  • Loading branch information
seungheon123 committed Nov 30, 2024
1 parent 94ee16d commit f548291
Showing 1 changed file with 15 additions and 24 deletions.
39 changes: 15 additions & 24 deletions .github/workflows/media-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ on:
push:
branches:
- develop
paths:
- 'apps/media/**'
- Fix/316
# paths:
# - 'apps/media/**'

jobs:
build-and-push:
Expand Down Expand Up @@ -36,28 +37,18 @@ jobs:
run: |
echo "$PASSWORD" | docker login -u "$USERNAME" "$REGISTRY_URL" --password-stdin
- name: Build Docker image
run: |
docker build \
--cache-from=${{ secrets.NCLOUD_REGISTRY_URL }}/$IMAGE_NAME:latest \
-f ./apps/media/Dockerfile \
-t ${{ secrets.NCLOUD_REGISTRY_URL }}/$IMAGE_NAME:latest \
--build-arg MEDIA_PORT=$MEDIA_PORT \
--build-arg REDIS_HOST=$REDIS_HOST \
--build-arg REDIS_PORT=$REDIS_PORT \
--build-arg REDIS_MEDIA=$REDIS_MEDIA \
--build-arg ANNOUNCED_IP=$ANNOUNCED_IP \
--build-arg API_SERVER_URL=$API_SERVER_URL \
--build-arg HTTP_TIMEOUT=$HTTP_TIMEOUT \
--build-arg RECORD_SERVER_URL=$RECORD_SERVER_URL \
--build-arg SERVER_PRIVATE_IP=$SERVER_PRIVATE_IP \
--build-arg PUBLIC_RECORD_SERVER_URL=$PUBLIC_RECORD_SERVER_URL \
--build-arg JWT_SECRET=$JWT_SECRET \
.
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Push to Ncloud Container Registry
run: |
docker push ${{ secrets.NCLOUD_REGISTRY_URL }}/$IMAGE_NAME:latest
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./apps/media/Dockerfile
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ secrets.NCLOUD_REGISTRY_URL }}/media-camon:latest

deploy-and-run:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -99,7 +90,7 @@ jobs:
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SSH_SERVER_KEY }}
port: 22
envs: MEDIA_PORT,REDIS_HOST,REDIS_PORT,REDIS_MEDIA,ANNOUNCED_IP,API_SERVER_URL,HTTP_TIMEOUT,RECORD_SERVER_URL,SERVER_PRIVATE_IP,PUBLIC_RECORD_SERVER_URL,NCLOUD_REGISTRY_URL,NCLOUD_ACCESS_KEY,NCLOUD_SECRET_KEY
envs: MEDIA_PORT,REDIS_HOST,REDIS_PORT,REDIS_MEDIA,ANNOUNCED_IP,API_SERVER_URL,HTTP_TIMEOUT,RECORD_SERVER_URL,SERVER_PRIVATE_IP,PUBLIC_RECORD_SERVER_URL,NCLOUD_REGISTRY_URL,NCLOUD_ACCESS_KEY,NCLOUD_SECRET_KEY,JWT_SECRET
script: |
cd /home/${{ secrets.SERVER_USER }}/camon
Expand Down

0 comments on commit f548291

Please sign in to comment.