Skip to content

Commit fccc6f0

Browse files
author
bu2000
committed
docker file 추가
1 parent 3315c3a commit fccc6f0

6 files changed

Lines changed: 65 additions & 31 deletions

File tree

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
dist
3+
.vscode
4+
.git
5+
.env

.github/workflows/frontend-ci.yml

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,45 @@
1-
name: Frontend CI (Vite Build)
1+
name: Frontend Docker CI/CD (Production Ready)
22

33
on:
44
push:
5-
branches: [ "main" ] # 브랜치 이름이 master라면 수정 필요
6-
pull_request:
7-
branches: [ "main" ]
5+
branches:
6+
- develop
7+
- main
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
812

913
jobs:
10-
build-check:
14+
build-and-push:
1115
runs-on: ubuntu-latest
1216

13-
strategy:
14-
matrix:
15-
node-version: [20.x] # Vite 6.x는 최신 Node 버전(18, 20+) 권장
17+
permissions:
18+
contents: read
19+
packages: write
1620

1721
steps:
18-
# 1. 코드 가져오기
19-
- name: Checkout code
20-
uses: actions/checkout@v4
21-
22-
# 2. Node.js 설정
23-
- name: Setup Node.js ${{ matrix.node-version }}
24-
uses: actions/setup-node@v4
25-
with:
26-
node-version: ${{ matrix.node-version }}
27-
cache: 'npm'
28-
29-
# 3. 의존성 설치
30-
# package-lock.json이 있다면 npm ci가 더 빠르고 안전합니다.
31-
# 만약 lock 파일이 없다면 npm install로 변경해서 사용하세요.
32-
- name: Install dependencies
33-
run: npm ci
34-
35-
# 4. 빌드 확인 (핵심 단계)
36-
# Vite 빌드가 실패하면 여기서 에러가 나고, PR에 빨간불이 들어옵니다.
37-
- name: Build Project
38-
run: npm run build
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Login to GHCR
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Build and Push Docker Image
36+
uses: docker/build-push-action@v5
37+
with:
38+
context: .
39+
file: ./Dockerfile
40+
push: true
41+
42+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/frontend:latest
43+
44+
cache-from: type=gha
45+
cache-to: type=gha,mode=max

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM node:18 AS build
2+
WORKDIR /app
3+
COPY package.json package-lock.json ./
4+
RUN npm install
5+
COPY . .
6+
RUN npm run build
7+
FROM nginx:latest
8+
COPY --from=build /app/dist /usr/share/nginx/html
9+
EXPOSE 80
10+
CMD ["nginx", "-g", "daemon off;"]

docker-compose.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: "3.8"
2+
services:
3+
web:
4+
build:
5+
context: .
6+
dockerfile: Dockerfile
7+
container_name: algorithm_chef_front_app
8+
9+
ports:
10+
- "5173:80"
11+
restart: always

src/api/userInfo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const BACKEND_DOMAIN = "http://localhost:8080/user";
44
export const makeSurveyApi = async (survey) => {
55
const token = localStorage.getItem("accessToken");
66
try {
7-
const response = await axios.post(`${BACKEND_DOMAIN}/survey`, survey, {
7+
const response = await axios.post(`${BACKEND_DOMAIN}/makeSurvey`, survey, {
88
headers: {
99
Authorization: `Bearer ${token}`,
1010
},

src/screens/MyPage/MyPageInfo.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { FaUser, FaBirthdayCake, FaIdCard } from "react-icons/fa";
22
import "./style.css";
33

44
function MyPageInfo({ age, id, birthDate }) {
5+
console.log("아이디", id);
56
return (
67
<div className="mypage-info-card">
78
<div className="mypage-info-header">
@@ -15,7 +16,7 @@ function MyPageInfo({ age, id, birthDate }) {
1516
</div>
1617
<div className="info-text">
1718
<span className="info-label">아이디</span>
18-
<span className="info-value">{id || "skt2008"}</span>
19+
<span className="info-value">{id}</span>
1920
</div>
2021
</div>
2122

0 commit comments

Comments
 (0)