Skip to content

Commit d0be103

Browse files
committed
first commit
0 parents  commit d0be103

File tree

105 files changed

+19954
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+19954
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Build Docker and Upload to S3
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build-and-upload:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout Code
14+
uses: actions/checkout@v3
15+
16+
- name: Create .env file
17+
run: |
18+
echo "DOCKER_HUB_USERNAME=${{ secrets.DOCKER_HUB_USERNAME }}" > .env
19+
echo "NEXT_PUBLIC_SUPABASE_URL=${{secrets.NEXT_PUBLIC_SUPABASE_URL}}" >> .env
20+
echo "NEXT_PUBLIC_SUPABASE_ANON_KEY=${{secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY}}" >> .env
21+
22+
- name: Login to DockerHub (Optional)
23+
uses: docker/login-action@v2
24+
with:
25+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
26+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
27+
28+
- name: Build and Push Docker Image
29+
run: |
30+
docker build -t ${{ secrets.DOCKER_HUB_USERNAME }}/gdgoc-solution-gallery:latest .
31+
docker run --rm ${{ secrets.DOCKER_HUB_USERNAME }}/gdgoc-solution-gallery:latest ls -la /app
32+
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/gdgoc-solution-gallery:latest
33+
34+
- name: Create Deployment Package
35+
run: |
36+
cp scripts/deploy.sh ./deploy.sh
37+
zip -r deploy.zip .env docker-compose.yml deploy.sh appspec.yml \
38+
Dockerfile package.json package-lock.json next.config.ts \
39+
pages public .next
40+
41+
- name: Configure AWS credentials
42+
run: |
43+
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }}
44+
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
45+
aws configure set region ${{ secrets.AWS_REGION }}
46+
47+
- name: Upload Deployment Package to S3
48+
run: |
49+
aws s3 cp deploy.zip s3://${{ secrets.AWS_S3_BUCKET }}/deploy.zip
50+
51+
- name: Trigger CodeDeploy (CLI)
52+
env:
53+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
54+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
55+
AWS_REGION: ap-northeast-2
56+
run: |
57+
aws deploy create-deployment \
58+
--application-name ${{ secrets.AWS_CODEDEPLOY_APP }} \
59+
--deployment-group-name ${{ secrets.AWS_CODEDEPLOY_GROUP }} \
60+
--s3-location bucket=${{ secrets.S3_BUCKET }},bundleType=zip,key=deploy.zip \
61+
--file-exists-behavior OVERWRITE

.gitignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
12+
13+
# testing
14+
/coverage
15+
16+
# next.js
17+
/.next/
18+
/out/
19+
20+
# production
21+
/build
22+
23+
# misc
24+
.DS_Store
25+
*.pem
26+
27+
# debug
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
.pnpm-debug.log*
32+
33+
# env files (can opt-in for committing if needed)
34+
.env*
35+
36+
# vercel
37+
.vercel
38+
39+
# typescript
40+
*.tsbuildinfo
41+
next-env.d.ts
42+
43+
# ide
44+
.idea/
45+
.cursor/

Dockerfile

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# 1단계: 빌드 환경
2+
FROM node:18 AS builder
3+
4+
ARG APP_DIR=/app
5+
WORKDIR ${APP_DIR}
6+
7+
# package.json과 package-lock.json을 먼저 복사하고, npm install 실행
8+
COPY package.json package-lock.json ./
9+
RUN npm install
10+
11+
# .env 파일을 먼저 복사
12+
COPY .env ./
13+
14+
# 이후 전체 파일 복사
15+
COPY . .
16+
17+
# next.config.ts 확인
18+
RUN cat next.config.ts
19+
20+
# 빌드 실행 (output: export가 있는지 확인)
21+
# 명시적으로 next build 명령 사용
22+
RUN npx next build
23+
24+
# 빌드 결과 확인
25+
RUN ls -la ${APP_DIR}
26+
RUN ls -la ${APP_DIR}/.next || echo ".next 디렉토리가 없습니다"
27+
RUN ls -la ${APP_DIR}/out || echo "out 디렉토리가 없습니다"
28+
29+
# 2단계: 실행 환경
30+
FROM node:18
31+
32+
ARG APP_DIR=/app
33+
WORKDIR ${APP_DIR}
34+
35+
# 프로덕션 의존성만 가져오기
36+
COPY package*.json ./
37+
RUN npm install --omit=dev
38+
39+
# .env 파일 복사
40+
COPY .env ./
41+
42+
# 빌드된 결과물 가져오기
43+
COPY --from=builder ${APP_DIR}/.next ./.next
44+
COPY --from=builder ${APP_DIR}/public ./public
45+
COPY --from=builder ${APP_DIR}/node_modules ./node_modules
46+
COPY --from=builder ${APP_DIR}/package.json ./package.json
47+
COPY --from=builder ${APP_DIR}/next.config.ts ./next.config.ts
48+
49+
# 실행환경 확인
50+
RUN ls -la ${APP_DIR}
51+
RUN ls -la ${APP_DIR}/.next || echo ".next 디렉토리가 없습니다"
52+
53+
EXPOSE 3001
54+
55+
# Next.js 서버 시작
56+
CMD ["npm", "run", "start"]

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
2+
3+
## Getting Started
4+
5+
First, run the development server:
6+
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
# or
12+
pnpm dev
13+
# or
14+
bun dev
15+
```
16+
17+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18+
19+
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20+
21+
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
22+
23+
## Learn More
24+
25+
To learn more about Next.js, take a look at the following resources:
26+
27+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29+
30+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
31+
32+
## Deploy on Vercel
33+
34+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35+
36+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.

appspec.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 0.0
2+
os: linux
3+
files:
4+
- source: /
5+
destination: /home/ubuntu/gdgoc-solution-gallery
6+
7+
hooks:
8+
AfterInstall:
9+
- location: deploy.sh
10+
timeout: 300
11+
runas: root

buildspec.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# 버전 정보
2+
version: 0.2
3+
4+
# 빌드 단계를 정의
5+
phases:
6+
# 빌드 전 단계
7+
pre_build:
8+
commands:
9+
- npm install # npm을 이용하여 필요한 패키지들을 설치
10+
# 빌드 단계
11+
build:
12+
commands:
13+
- npm run build # npm 스크립트를 통해 빌드 수행
14+
15+
# 빌드 후 생성된 결과물에 대한 정보
16+
artifacts:
17+
files:
18+
- '**/*' # 모든 파일과 디렉토리를 포함
19+
base-directory: out # Next.js 정적 사이트 파일이 있는 디렉토리로 변경

docker-compose.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: "3.8"
2+
3+
services:
4+
frontend:
5+
image: "${DOCKER_HUB_USERNAME}/gdgoc-solution-gallery:latest"
6+
container_name: gdgoc-solution-gallery
7+
restart: always
8+
ports:
9+
- "3001:3001"
10+
environment:
11+
NODE_ENV: production
12+
working_dir: /app
13+
command: "npm run start"
14+

eslint.config.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { dirname } from "path";
2+
import { fileURLToPath } from "url";
3+
import { FlatCompat } from "@eslint/eslintrc";
4+
5+
const __filename = fileURLToPath(import.meta.url);
6+
const __dirname = dirname(__filename);
7+
8+
const compat = new FlatCompat({
9+
baseDirectory: __dirname,
10+
});
11+
12+
const eslintConfig = [
13+
...compat.extends("next/core-web-vitals", "next/typescript"),
14+
];
15+
16+
export default eslintConfig;

next.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type { NextConfig } from "next";
2+
3+
const nextConfig: NextConfig = {
4+
/* config options here */
5+
images: {
6+
domains: ['ytyzerwpwcelmazjbfhv.supabase.co', 'placehold.co']
7+
}
8+
};
9+
10+
export default nextConfig;

0 commit comments

Comments
 (0)