Skip to content
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
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: ✨ Feature
about: 새로운 기능에 대한 이슈
title: ''
labels: ''
assignees: ''

---

## 🪄 Description
해당 이슈에 대한 설명

## ❤️ Changes

### 🌳 작업 사항
- [ ] 세부 사항 1


## 📊 API
| URL | method | Usage | Authorization Needed |
| ------------------ | ------ | -------------------- | -------------------- |

## 😃 Additional context

10 changes: 10 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## #️⃣ 연관된 이슈
> #이슈번호, #이슈번호

## 📝 작업 내용

> 작업내용 설명

### ✨ 스크린샷

### 💬 리뷰 요구사항
86 changes: 86 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Deploy Frontend

on:
push:
branches:
- develop
- main

env:
AWS_REGION: ap-northeast-2
ECR_REGISTRY: 774023531956.dkr.ecr.ap-northeast-2.amazonaws.com
ECR_REPOSITORY: streamly/frontend

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
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@v2

- name: Build and push image
run: |
docker build -t ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest \
-t ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ github.sha }} .
docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest
docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ github.sha }}

- name: Clean up old ECR images
run: |
IMAGE_IDS=$(aws ecr describe-images \
--repository-name ${{ env.ECR_REPOSITORY }} \
--query 'sort_by(imageDetails,& imagePushedAt)[:-5].[imageDigest]' \
--output text)

if [ ! -z "$IMAGE_IDS" ]; then
echo "Deleting old images..."
echo "$IMAGE_IDS" | while read digest; do
aws ecr batch-delete-image \
--repository-name ${{ env.ECR_REPOSITORY }} \
--image-ids imageDigest=$digest
done
fi

- name: Deploy to EC2
uses: appleboy/ssh-action@v1.0.0
with:
host: ${{ secrets.EC2_HOST }}
username: ubuntu
key: ${{ secrets.EC2_SSH_KEY }}
script: |
cd ~/INFRA

# ECR 로그인
aws ecr get-login-password --region ap-northeast-2 | \
docker login --username AWS --password-stdin \
774023531956.dkr.ecr.ap-northeast-2.amazonaws.com

# Frontend 업데이트
docker-compose pull frontend
docker-compose up -d --no-deps frontend

# 이전 이미지 정리
docker image prune -f

echo "✅ Frontend deployment completed!"

- name: Notify
if: always()
run: |
if [ ${{ job.status }} == 'success' ]; then
echo "✅ Frontend deployment successful!"
else
echo "❌ Frontend deployment failed!"
fi
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ yarn-error.log*
.pnpm-debug.log*

# env files
.env*
.env

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
next-env.d.ts

nul
10 changes: 10 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/FE.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Multi-stage build for production
FROM node:20-alpine AS builder

WORKDIR /app

# Copy package files
COPY package.json package-lock.json* ./

# Install dependencies
RUN npm ci

# Copy source code
COPY . .

# Build Next.js application
ENV NEXT_TELEMETRY_DISABLED 1
RUN npm run build

# Production stage
FROM node:20-alpine AS runner

WORKDIR /app

ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1

# Create non-root user
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nextjs

# Copy built application
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static

# Change ownership
RUN chown -R nextjs:nodejs /app

USER nextjs

EXPOSE 3000

ENV PORT 3000
ENV HOSTNAME "0.0.0.0"

CMD ["node", "server.js"]
Loading