Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEW : Client - Storybook CD 구축 #4

Merged
merged 1 commit into from
Nov 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/Storybook-CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Storybook CD
on:
push:
branches: ["main"]
paths: client/**
jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Build Docker Image
run: docker build -f storybook.Dockerfile -t ${{ secrets.CLIENT_STORYBOOK_REPO }}/${{ secrets.CLIENT_STORYBOOK_NAME }}:latest .
working-directory: ./client

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.CLIENT_DOCKER_USERNAME }}
password: ${{ secrets.CLIENT_DOCKER_PASSWORD }}

- name: Push Image to Dockerhub
run: docker push ${{ secrets.CLIENT_STORYBOOK_REPO }}/${{ secrets.CLIENT_STORYBOOK_NAME }}:latest

- name: executing remote ssh commands using password
uses: appleboy/[email protected]
with:
host: ${{ secrets.STORYBOOK_CLOUD_HOST }}
username: root
password: ${{ secrets.STORYBOOK_CLOUD_PASSWORD }}
port: ${{ secrets.STORYBOOK_CLOUD_PORT }}
script: |
sudo docker pull ${{ secrets.CLIENT_STORYBOOK_REPO }}/${{ secrets.CLIENT_STORYBOOK_NAME }}:latest
sudo docker rm -f $(docker ps -qa)
sudo docker run --name storybook-static -d -p 80:80 ${{ secrets.CLIENT_STORYBOOK_REPO }}/${{ secrets.CLIENT_STORYBOOK_NAME }}:latest
docker image prune -f
jobkaeHenry marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 2 additions & 2 deletions client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs

EXPOSE 3000
EXPOSE ${PORT}

ENV PORT 3000
ENV PORT ${PORT}
# set hostname to localhost
ENV HOSTNAME "0.0.0.0"

jobkaeHenry marked this conversation as resolved.
Show resolved Hide resolved
Expand Down