Skip to content

Commit

Permalink
Merge pull request #235 from TEAM-MONGDOL/develop
Browse files Browse the repository at this point in the history
[merge] develop into main
  • Loading branch information
MinhoJJang authored Aug 16, 2024
2 parents ae9904e + 07bfb52 commit c3a1a52
Show file tree
Hide file tree
Showing 45 changed files with 517 additions and 239 deletions.
84 changes: 58 additions & 26 deletions .github/workflows/nextjs-prod-CD.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: NextJS CD

on:
release:
types: [created]
workflow_dispatch:
repository_dispatch:

env:
KCR_REGISTRY: dkation.kr-central-2.kcr.dev
KCR_REPOSITORY: dkation-prod-front/dkation-prod-fe
ACCESS_KEY: ${{ secrets.ACCESS_KEY }}
ACCESS_SECRET_KEY: ${{ secrets.ACCESS_SECRET_KEY }}

jobs:
deploy:
Expand All @@ -15,50 +18,79 @@ jobs:
with:
fetch-depth: 0

- name: Get release tag
id: get_tag
- name: Get release tag or commit hash
id: get_version
run: |
if [[ ${{ github.event_name }} == 'release' ]]; then
echo "tag=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
echo "version=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
else
git fetch --tags
latest_tag=$(git describe --tags --abbrev=0)
echo "tag=$latest_tag" >> $GITHUB_OUTPUT
echo "version=$latest_tag" >> $GITHUB_OUTPUT
fi
- name: Setup SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_KEY }}

- name: Deploy to FE
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.BASTION_HOST }}
host: ${{ secrets.BASTION_IP }}
username: ${{ secrets.USER }}
key: ${{ secrets.SSH_KEY }}
script: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
IFS=',' read -r -a HOSTS <<< "${{ secrets.WEB_IPS }}"
KCR_REGISTRY="${{ env.KCR_REGISTRY }}"
KCR_REPOSITORY="${{ env.KCR_REPOSITORY }}"
VERSION="${{ steps.get_version.outputs.version }}"
AK="${{ env.ACCESS_KEY }}"
SK="${{ env.ACCESS_SECRET_KEY }}"
for host in "${HOSTS[@]}"
do
echo "$host"
ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no ubuntu@$host << EOF
echo "Deploying to $host"
ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no ${{ secrets.USER }}@$host << EOF
set -e
echo "Stopping and removing existing containers"
docker ps -q --filter ancestor=dkation.kr-central-2.kcr.dev/dkation-prod-front/dkation-prod-fe | xargs -r docker stop
docker ps -aq --filter ancestor=dkation.kr-central-2.kcr.dev/dkation-prod-front/dkation-prod-fe | xargs -r docker rm
docker ps --format '{{.ID}} {{.Image}}' | grep '$KCR_REGISTRY/$KCR_REPOSITORY' | awk '{print \$1}' | xargs -r docker stop
docker ps -a --format '{{.ID}} {{.Image}}' | grep '$KCR_REGISTRY/$KCR_REPOSITORY' | awk '{print \$1}' | xargs -r docker rm
echo "Removing old Docker images"
docker images dkation.kr-central-2.kcr.dev/dkation-prod-front/dkation-prod-fe --format '{{.ID}}' | xargs -r docker rmi
echo "Login to KCR"
docker login dkation.kr-central-2.kcr.dev --username ${{ secrets.ACCESS_KEY }} --password ${{ secrets.ACCESS_SECRET_KEY }}
docker images --format '{{.Repository}}:{{.Tag}}' | grep '$KCR_REGISTRY/$KCR_REPOSITORY' | xargs -r docker rmi
echo "Docker login"
echo "$SK" | docker login $KCR_REGISTRY -u "$AK" --password-stdin
echo "Pulling new Docker image"
docker pull dkation.kr-central-2.kcr.dev/dkation-prod-front/dkation-prod-fe:${{ steps.get_tag.outputs.tag }}
docker pull $KCR_REGISTRY/$KCR_REPOSITORY:$VERSION
echo "Running new Docker container"
docker run -d -p 80:3000 dkation.kr-central-2.kcr.dev/dkation-prod-front/dkation-prod-fe:${{ steps.get_tag.outputs.tag }}
EOF
docker run -d -p 80:3000 --name dkation-frontend $KCR_REGISTRY/$KCR_REPOSITORY:$VERSION
echo "Checking container health"
max_retries=5
retries=0
until docker ps | grep dkation-frontend | grep -q "Up" || [ \$retries -eq \$max_retries ]
do
echo "Waiting for container to be healthy..."
sleep 5
retries=\$((retries+1))
done
if [ \$retries -eq \$max_retries ]; then
echo "Container failed to start properly"
exit 1
fi
echo "Container is up and running"
EOF
if [ $? -ne 0 ]; then
echo "Deployment to $host failed"
exit 1
fi
echo "Deployment completed successfully"
done
3 changes: 2 additions & 1 deletion .github/workflows/nextjs-prod-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ jobs:
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
tag_name: ${{ steps.create_tag.outputs.NEW_TAG }}
release_name: Release ${{ steps.create_tag.outputs.NEW_TAG }}
draft: false
prerelease: false
token: ${{ secrets.PAT }}
22 changes: 22 additions & 0 deletions public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion public/next.svg

This file was deleted.

1 change: 0 additions & 1 deletion public/vercel.svg

This file was deleted.

6 changes: 3 additions & 3 deletions src/app/(route)/(user)/(with-layout)/points/apply/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ const PointsApplyPage = () => {
<div className="flex w-full flex-col">
<UserTableContainer>
<UserTableHeaderModule>
<UserTableHeaderAtom isFirst text="번호" width="200px" />
<UserTableHeaderAtom isFirst text="번호" width="100px" />
<UserTableHeaderAtom text="구분" />
<UserTableHeaderAtom text="신청 일시" width="200px" />
<UserTableHeaderAtom text="상태" width="200px" />
<UserTableHeaderAtom isLast text="" width="100px" />
<UserTableHeaderAtom text="상태" width="150px" />
<UserTableHeaderAtom isLast text="" width="80px" />
</UserTableHeaderModule>
<tbody>
{!data ? (
Expand Down
14 changes: 9 additions & 5 deletions src/app/(route)/(user)/(with-layout)/points/history/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ const PointsHistoryPage = () => {
<div className="flex w-full flex-col gap-y-[200px]">
<UserTableContainer>
<UserTableHeaderModule>
<UserTableHeaderAtom isFirst text="번호" width="200px" />
<UserTableHeaderAtom isFirst text="번호" width="100px" />
<UserTableHeaderAtom text="사유" />
<UserTableHeaderAtom text="일시" width="200px" />
<UserTableHeaderAtom text="적립/사용" width="250px" />
<UserTableHeaderAtom isLast text="잔여 포인트" width="200px" />
<UserTableHeaderAtom text="일시" />
<UserTableHeaderAtom text="적립/사용" width="150px" />
<UserTableHeaderAtom isLast text="잔여 포인트" width="150px" />
</UserTableHeaderModule>
<tbody>
{!data ? (
Expand All @@ -55,7 +55,11 @@ const PointsHistoryPage = () => {
<UserTableBodyAtom isFirst>
{(currentPage - 1) * 6 + idx + 1}
</UserTableBodyAtom>
<UserTableBodyAtom>{item.pointTitle}</UserTableBodyAtom>
<UserTableBodyAtom>
<div className="line-clamp-1 w-full text-center">
{item.pointTitle}
</div>
</UserTableBodyAtom>
<UserTableBodyAtom>
{dateConverter(item.getTime)}
</UserTableBodyAtom>
Expand Down
24 changes: 14 additions & 10 deletions src/app/(route)/(user)/(with-layout)/points/policy/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ const PointsPolicyPage = () => {
<h2 className="text-h2 font-semibold text-sub-400">포인트 정책</h2>
<div className="flex w-full flex-col gap-y-[200px]">
<div className="flex w-full flex-col gap-y-2.5">
<div className="flex h-10 w-full items-center justify-center gap-x-7 rounded bg-sub-100/20 px-[68px] text-center text-4 text-sub-300">
<p className="w-[100px]">번호</p>
<div className="flex h-10 w-full items-center justify-center gap-x-7 rounded bg-sub-100/20 px-6 text-center text-4 text-sub-300 xl:px-10">
<p className="w-1/12 shrink-0">번호</p>
<p className="grow">분류</p>
<p className="w-60">점수</p>
<p className="w-48">등록 일시</p>
<p className="w-10" />
<p className="w-2/12 shrink-0">점수</p>
<p className="w-2/12 shrink-0">등록 일시</p>
<p className="w-1/12 shrink-0" />
</div>
<div className="flex w-full flex-col gap-y-2.5">
{!policyList ? (
Expand All @@ -66,18 +66,22 @@ const PointsPolicyPage = () => {
<div
role="presentation"
key={item.id}
className="flex h-[63px] w-full cursor-pointer items-center justify-center gap-x-7 rounded border border-stroke-100 bg-white px-[68px] text-center font-medium text-sub-400"
className="flex h-[63px] w-full cursor-pointer items-center justify-center gap-x-7 rounded border border-stroke-100 bg-white px-6 text-center font-medium text-sub-400 xl:px-10"
onClick={() => {
setCurrentOpen(currentOpen === item.id ? null : item.id);
}}
>
<p className="w-[100px]">
<p className="w-1/12 shrink-0">
{(currentPage - 1) * 5 + idx + 1}
</p>
<p className="grow">{item.policyTitle}</p>
<p className="w-60">{item.quantity.toLocaleString()}</p>
<p className="w-48">{dateConverter(item.modifiedAt)}</p>
<div className="w-10">
<p className="w-2/12 shrink-0">
{item.quantity.toLocaleString()}
</p>
<p className="w-2/12 shrink-0">
{dateConverter(item.modifiedAt)}
</p>
<div className="flex w-1/12 justify-center">
<Image
src={DownArrowIcon}
alt="policy-toggle"
Expand Down
12 changes: 8 additions & 4 deletions src/app/(route)/(user)/(with-layout)/support/notices/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ const UserNoticePage = () => {
<UserTableContainer>
<UserTableHeaderModule>
<UserTableHeaderAtom isFirst width="120px" text="번호" />
<UserTableHeaderAtom width="180px" text="구분" />
<UserTableHeaderAtom width="150px" text="구분" />
<UserTableHeaderAtom text="제목" />
<UserTableHeaderAtom width="200px" text="등록 일시" />
<UserTableHeaderAtom isLast width="140px" text="" />
<UserTableHeaderAtom width="150px" text="등록 일시" />
<UserTableHeaderAtom isLast width="100px" text="" />
</UserTableHeaderModule>

<tbody>
Expand All @@ -145,7 +145,11 @@ const UserNoticePage = () => {
/>
</div>
</UserTableBodyAtom>
<UserTableBodyAtom>{item.title}</UserTableBodyAtom>
<UserTableBodyAtom>
<p className="line-clamp-1 w-full text-start">
{item.title}
</p>
</UserTableBodyAtom>
<UserTableBodyAtom>
{dayjs(item.createdAt).format('YYYY.MM.DD')}
</UserTableBodyAtom>
Expand Down
60 changes: 35 additions & 25 deletions src/app/(route)/(user)/(with-layout)/workation/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,35 +252,45 @@ const Workation = () => {
<div
role="presentation"
key={wkt.wktId}
className="mb-24 flex w-full"
className="mb-24 flex w-full justify-between gap-x-4"
onClick={() => router.push(`/workation/${wkt.wktId}`)}
>
<Image
className="h-[304px] w-[402px] object-cover"
width={402}
height={304}
src={wkt.thumbnailUrl}
alt="place"
/>
<div className="ml-8 flex-col">
<p className="mb-1.5 text-sub-300">{wkt.wktPlaceTitle}</p>
<h2 className="mb-24 text-h2 font-semibold text-sub-400">
{wkt.title}
</h2>
<p className="mb-4 inline-block rounded-regular bg-[#FF2424]/10 px-5 py-1.5 text-3 text-[#FF2424]">
모집인원 : {wkt.totalRecruit}
</p>
<p className="mb-0.5">
모집 기간 : {dayjs(wkt.applyStartDate).format('YYYY.MM.DD')} -{' '}
{dayjs(wkt.applyEndDate).format('YYYY.MM.DD')}
</p>
<p>
워케이션 기간 : {dayjs(wkt.startDate).format('YYYY.MM.DD')} -{' '}
{dayjs(wkt.endDate).format('YYYY.MM.DD')}
</p>
<div className="flex items-end gap-x-8">
<Image
className="h-[237px] w-[345px] object-cover xl:h-[304px] xl:w-[442px]"
width={402}
height={304}
src={wkt.thumbnailUrl}
alt="place"
/>
<div className="flex h-full flex-col items-start justify-between gap-y-4">
<div className="flex flex-col gap-y-1.5">
<p className="text-sub-300">{wkt.wktPlaceTitle}</p>
<h2 className="line-clamp-1 break-keep text-h2 font-semibold text-sub-400 xl:line-clamp-2">
{wkt.title}
</h2>
</div>
<div className="flex flex-col items-start gap-y-4">
<p className="flex items-center justify-center rounded-regular bg-[#FF2424]/10 px-5 py-1.5 text-3 text-[#FF2424]">
모집인원 : {wkt.totalRecruit}
</p>
<div className="flex flex-col gap-y-0.5">
<p>
모집 기간 : <br className="block xl:hidden" />
{dayjs(wkt.applyStartDate).format('YYYY.MM.DD')} -{' '}
{dayjs(wkt.applyEndDate).format('YYYY.MM.DD')}
</p>
<p>
워케이션 기간 : <br className="block xl:hidden" />
{dayjs(wkt.startDate).format('YYYY.MM.DD')} -{' '}
{dayjs(wkt.endDate).format('YYYY.MM.DD')}
</p>
</div>
</div>
</div>
</div>
<UserTextLabelAtom
className={`ml-auto mt-auto ${getStatusLabelAndColor(wkt.applyStartDate, wkt.applyEndDate).color}`}
className={`mt-auto shrink-0 ${getStatusLabelAndColor(wkt.applyStartDate, wkt.applyEndDate).color}`}
text={
getStatusLabelAndColor(wkt.applyStartDate, wkt.applyEndDate)
.label
Expand Down
Loading

0 comments on commit c3a1a52

Please sign in to comment.