Skip to content

Commit

Permalink
feat: [LINKER-34] 불필요한 도커 이미지 제거 (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
useonglee authored Dec 19, 2023
1 parent 7e473c9 commit 791f221
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.next
23 changes: 23 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,29 @@ env:
AWS_REGION: ap-northeast-2

jobs:
cleanup:
runs-on: ubuntu-latest

steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Cleanup Unused ECR Images
id: cleanup-images
env:
ECR_REPOSITORY: linker
IMAGE_TAG: ${{ github.sha }}
run: |
aws ecr batch-delete-image --repository-name $ECR_REPOSITORY --image-ids imageTag=$IMAGE_TAG
deploy:
runs-on: ubuntu-latest
environment: production
Expand Down
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ RUN yarn install

RUN /bin/sh -c yarn workspace web build

# 이미지 정리
RUN rm -rf node_modules && \
rm -rf /usr/local/share/.cache && \
yarn workspaces focus && \
yarn cache clean

FROM node:18.17.0-alpine
EXPOSE 3000

Expand Down

0 comments on commit 791f221

Please sign in to comment.