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
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,20 @@ jobs:
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}

- name: Debug Secret
run: echo '${{ secrets.DEV_ONE_APP_CONFIG }}'

- name: Create .env file for one-app
run: |
echo '${{ secrets.DEV_ONE_APP_CONFIG }}' | jq -r 'to_entries | .[] | "\(.key)=\(.value)"' > services/one-app/.env

- name: Install dependencies
uses: ./.github/actions/yarn-install

- name: TypeScript Compilation Check
run: yarn tsc --noEmit --project tsconfig.json
working-directory: ./services/one-app

- name: Test
run: yarn test:one-app

Expand Down
98 changes: 98 additions & 0 deletions .github/workflows/deploy-one-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Build & Deploy Ahhachul One App

on:
push:
branches:
- main
paths:
- 'services/one-app/**'

env:
DEFAULT_NODE_VERSION: '20.14.0'

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Check Out Repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Parse secrets from JSON
id: secrets
run: |
echo '${{ secrets.DEV_META_DATA }}' | jq -r 'to_entries | .[] | "echo \(.key)=\(.value) >> $GITHUB_ENV"' | bash

- name: Print AWS Region
run: echo "AWS_REGION is $AWS_REGION"

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}

- name: Install dependencies
uses: ./.github/actions/yarn-install

- name: Create .env file for one-app
run: |
echo '${{ secrets.DEV_ONE_APP_CONFIG }}' > config.json
cat config.json | jq -r 'to_entries[] | "\(.key)=\(.value)"' >> services/one-app/.env

- name: Build one-app
run: yarn build:one-app

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

- name: Log in to Amazon ECR Public
run: |
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${{ env.ECR_REPOSITORY_URI }}

- name: Build Docker image for one-app
run: docker build -t ${{ env.ECR_REPOSITORY_URI }}:one-app-latest -f Dockerfile .

- name: Push Docker image for one-app to Amazon ECR
run: docker push ${{ env.ECR_REPOSITORY_URI }}:one-app-latest

- name: Get the latest Task Definition ARN for one-app
id: task_definition_one_app
run: |
TASK_DEF_ARN=$(aws ecs describe-services \
--cluster ${{ env.ECS_CLUSTER_NAME }} \
--services ${{ env.ECS_SERVICE_NAME }} \
--query 'services[0].taskDefinition' --output text)
echo "TASK_DEF_ARN_ONE_APP=$TASK_DEF_ARN" >> $GITHUB_ENV

- name: Generate appspec.yaml for one-app
run: |
cat <<EOF > ./appspec-one-app.yaml
version: 0.0
Resources:
- TargetService:
Type: AWS::ECS::Service
Properties:
TaskDefinition: "$TASK_DEF_ARN_ONE_APP"
LoadBalancerInfo:
ContainerName: ${{ env.CONTAINER_NAME }}
ContainerPort: ${{ env.CONTAINER_PORT }}
CapacityProviderStrategy:
- CapacityProvider: "FARGATE_SPOT"
Base: 0
Weight: 1
EOF

- name: Create Codedeploy deployment for one-app
run: |
APPSPEC_CONTENT=$(cat appspec-one-app.yaml | jq -sR .)
aws deploy create-deployment \
--application-name ${{ env.CODEDEPLOY_APP_NAME }} \
--deployment-group-name ${{ env.CODEDEPLOY_DEPLOYMENT_GROUP }} \
--deployment-config-name CodeDeployDefault.ECSAllAtOnce \
--revision "{\"revisionType\":\"AppSpecContent\",\"appSpecContent\":{\"content\":$APPSPEC_CONTENT}}"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ dist

.env
**/.env

.pnp.cjs
45,607 changes: 0 additions & 45,607 deletions .pnp.cjs

This file was deleted.

6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM node:20-alpine
RUN apk add --no-cache libc6-compat
WORKDIR /app

COPY services/next.ahhachul.com ./services/next.ahhachul.com
COPY services/one-app ./services/one-app
COPY nx.json tsconfig* ./
COPY package.json ./
COPY yarn.lock .pnp* ./
Expand All @@ -13,8 +13,8 @@ RUN yarn install

ENV NEXT_TELEMETRY_DISABLED=1

RUN yarn build:web
RUN yarn build:one-app

EXPOSE 3000

CMD ["yarn", "start:web"]
CMD ["yarn", "start:one-app"]
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
### AHHACHUL-Frontend

> **지하철에선? 아하철!**
>
>
> 지하철에서도 즐거우면 안될까요? 🙃🙃

## 👨‍💻 만든 사람들

- 이효범 :octocat: 📚
- 양아름 :octocat: 📚
- 최윤정 :octocat: 📚
- 이희제 :octocat: 📚
6 changes: 3 additions & 3 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
docker stop ahhachul_web
docker rm ahhachul_web

docker rmi $(docker images ahhachul/ahhachul_web -q)
docker rmi $(docker images ahhachul/ahhachul-dev-web -q)

docker pull ahhachul/ahhachul_web
docker pull ahhachul/ahhachul-dev-web

docker run --name ahhachul_web -d -p 3000:3000 ahhachul/ahhachul_web:latest
docker run --name ahhachul_web -d -p 3000:3000 ahhachul/ahhachul-dev-web:one-app-latest

echo "Deployment script executed successfully."
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
"storybook": "nx storybook @ahhachul/storybook",
"dev:one-app": "yarn workspace @ahhachul/one-app dev",
"test:one-app": "yarn workspace @ahhachul/one-app test",
"dev:mocking": "yarn workspace @ahhachul/one-app dev:mocking",
"server:mocking": "yarn workspace @ahhachul/one-app server:mocking",
"build:one-app": "nx build @ahhachul/one-app",
"build:all": "nx run-many --target=build --all"
"build:all": "nx run-many --target=build --all",
"start:one-app": "yarn workspace @ahhachul/one-app start"
},
"lint-staged": {
"*.{ts,tsx}": "eslint --fix"
Expand Down
19 changes: 18 additions & 1 deletion services/one-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,58 @@
"private": true,
"scripts": {
"dev": "next dev",
"dev:mocking": "NEXT_PUBLIC_API_MOCKING=enabled next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage"
"test:coverage": "jest --coverage",
"server:mocking": "npx tsx watch ./src/mocks/http.ts"
},
"dependencies": {
"@faker-js/faker": "^9.0.3",
"@tanstack/react-query": "^5.59.16",
"axios": "^1.7.7",
"clsx": "^2.1.1",
"js-cookie": "^3.0.5",
"next": "14.2.16",
"react": "^18",
"react-dom": "^18",
"tailwind-merge": "^2.5.4",
"zod": "^3.23.8",
"zustand": "^5.0.0"
},
"devDependencies": {
"@mswjs/http-middleware": "^0.10.2",
"@tanstack/react-query-devtools": "^5.59.16",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.2",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^14.5.2",
"@types/cors": "^2.8.17",
"@types/express": "^5.0.0",
"@types/jest": "^29.5.14",
"@types/js-cookie": "^3.0.6",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"autoprefixer": "^10.0.1",
"cors": "^2.8.5",
"eslint": "^8",
"eslint-config-next": "14.1.4",
"express": "^4.21.1",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"msw": "^2.5.2",
"postcss": "^8",
"tailwindcss": "^3.3.0",
"ts-jest": "^29.1.1",
"typescript": "^5"
},
"msw": {
"workerDirectory": [
"public"
]
}
}
Loading
Loading