Skip to content

Commit

Permalink
🔨 refactor: base-image도 docker hub에 올리는 방법으로 재수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Honghyeonji committed Jan 14, 2025
1 parent 21a317b commit 338df41
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
46 changes: 22 additions & 24 deletions .github/workflows/boolock-dev-cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-docker-${{ hashFiles('Dockerfile') }}
key: ${{ runner.os }}-docker-${{ hashFiles('Dockerfile', 'Dockerfile.base', 'docker-compose.yml') }}
restore-keys: |
${{ runner.os }}-docker-
Expand All @@ -51,27 +51,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
# uses: docker/build-push-action@v4
# with:
# context: .
# file: Dockerfile.base
# push: true
# tags: ${{ secrets.DOCKERHUB_USERNAME }}/base-image:latest
# cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/base-image:latest
# cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/base-image:latest
# outputs: type=docker

- name: Build Base Image
- name: Build and Push Base Image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.base
push: false
tags: base-image:latest
cache-from: type=inline
cache-to: type=inline
load: true
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/base-image:latest
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/base-image:latest
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/base-image:latest
outputs: type=docker

# - name: Build Base Image
# uses: docker/build-push-action@v4
# with:
# context: .
# file: Dockerfile.base
# push: false
# tags: base-image:latest
# cache-from: type=inline
# cache-to: type=inline
# load: true

- name: Build and Push Frontend Image
uses: docker/build-push-action@v4
Expand All @@ -82,9 +82,8 @@ jobs:
tags: ${{ secrets.DOCKERHUB_USERNAME }}/boolock_client_test:latest
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/boolock_client_test:latest
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/boolock_client_test:latest
# outputs: type=docker
# build-args: |
# DOCKERHUB_USERNAME=${{ secrets.DOCKERHUB_USERNAME }}
build-args: |
DOCKERHUB_USERNAME=${{ secrets.DOCKERHUB_USERNAME }}
- name: Build and Push Backend Image
uses: docker/build-push-action@v4
Expand All @@ -95,9 +94,8 @@ jobs:
tags: ${{ secrets.DOCKERHUB_USERNAME }}/boolock_server_test:latest
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/boolock_server_test:latest
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/boolock_server_test:latest
# outputs: type=docker
# build-args: |
# DOCKERHUB_USERNAME=${{ secrets.DOCKERHUB_USERNAME }}
build-args: |
DOCKERHUB_USERNAME=${{ secrets.DOCKERHUB_USERNAME }}
deploy:
needs: build
Expand Down
3 changes: 2 additions & 1 deletion apps/client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM base-image AS frontend-build
ARG DOCKERHUB_USERNAME
FROM ${DOCKERHUB_USERNAME}/base-image AS frontend-build

WORKDIR /app/apps/client
COPY ./apps/client .
Expand Down
3 changes: 2 additions & 1 deletion apps/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM base-image AS backend-build
ARG DOCKERHUB_USERNAME
FROM ${DOCKERHUB_USERNAME}/base-image AS backend-build

WORKDIR /app/apps/server
COPY ./apps/server .
Expand Down

0 comments on commit 338df41

Please sign in to comment.