Skip to content

Commit

Permalink
🔨 refactor: github actions 캐시사용하는 방식으로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Honghyeonji committed Jan 13, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent f3d003e commit d912b29
Showing 1 changed file with 23 additions and 32 deletions.
55 changes: 23 additions & 32 deletions .github/workflows/boolock-dev-cicd.yml
Original file line number Diff line number Diff line change
@@ -12,15 +12,14 @@ jobs:

steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v2

- name: Cache Docker layers
uses: actions/cache@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
path: /tmp/.buildx-cache
key: ${{ runner.os }}-docker-${{ github.sha }}
restore-keys: |
${{ runner.os }}-docker-
- name: Set BE .env
run: |
@@ -43,35 +42,27 @@ jobs:
echo "${{ secrets.SSL_FULLCHAIN }}" > apps/client/ssl/fullchain.pem
echo "${{ secrets.SSL_PRIVKEY }}" > apps/client/ssl/privkey.pem
- name: Build and Push Base Image
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build base image
run: |
docker buildx build \
--file Dockerfile.base \
--tag ${{ secrets.DOCKERHUB_USERNAME }}/base-image:latest \
--cache-from=type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/base-image:cache \
--cache-to=type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/base-image:cache,mode=max \
--push .
- name: Tag Base Image Locally
run: docker tag ${{ secrets.DOCKERHUB_USERNAME }}/base-image:latest base-image
docker build . --file Dockerfile.base --tag ${{ secrets.DOCKERHUB_USERNAME }}/base-image:latest
docker tag ${{ secrets.DOCKERHUB_USERNAME }}/base-image:latest base-image
- name: Build and Push Frontend Image
- name: Build frontend and backend images
run: |
docker buildx build \
--file apps/client/Dockerfile \
--tag ${{ secrets.DOCKERHUB_USERNAME }}/boolock_client_test:latest \
--cache-from=type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/boolock_client_test:cache \
--cache-to=type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/boolock_client_test:cache,mode=max \
--push .
docker build . --file apps/client/Dockerfile --tag ${{ secrets.DOCKERHUB_USERNAME }}/boolock_client_test:latest
docker build . --file apps/server/Dockerfile --tag ${{ secrets.DOCKERHUB_USERNAME }}/boolock_server_test:latest
- name: Build and Push Backend Image
- name: Docker Hub push
run: |
docker buildx build \
--file apps/server/Dockerfile \
--tag ${{ secrets.DOCKERHUB_USERNAME }}/boolock_server_test:latest \
--cache-from=type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/boolock_server_test:cache \
--cache-to=type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/boolock_server_test:cache,mode=max \
--push .
docker push ${{ secrets.DOCKERHUB_USERNAME }}/base-image:latest
docker push ${{ secrets.DOCKERHUB_USERNAME }}/boolock_client_test:latest
docker push ${{ secrets.DOCKERHUB_USERNAME }}/boolock_server_test:latest
deploy:
needs: build

0 comments on commit d912b29

Please sign in to comment.