Skip to content

Commit

Permalink
Merge pull request 9oormthonUniv-seoultech#41 from 9oormthonUniv-seou…
Browse files Browse the repository at this point in the history
…ltech/develop

1차 배포
  • Loading branch information
jaeyo03 authored Nov 1, 2024
2 parents 75fbf3f + 0e3a766 commit f81cf99
Show file tree
Hide file tree
Showing 143 changed files with 5,877 additions and 30 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ dist-ssr
*.njsproj
*.sln
*.sw?

.env
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Base image for building
FROM node:18-alpine AS base

# Define arguments for environment variables
ARG VITE_KAKAO_MAP_KEY
ARG VITE_KAKAO_REST_API_KEY

# Install dependencies
WORKDIR /app
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN \
if [ -f yarn.lock ]; then yarn install --frozen-lockfile; \
elif [ -f package-lock.json ]; then npm ci; \
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm install --frozen-lockfile; \
else echo "Lockfile not found." && exit 1; \
fi

# Copy source code and set environment variables
COPY . .
ENV VITE_KAKAO_MAP_KEY=${VITE_KAKAO_MAP_KEY}
ENV VITE_KAKAO_REST_API_KEY=${VITE_KAKAO_REST_API_KEY}

# Build the Vite application
RUN \
if [ -f yarn.lock ]; then yarn build; \
elif [ -f package-lock.json ]; then npm run build; \
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
else echo "Lockfile not found." && exit 1; \
fi

# Nginx server to serve static files
FROM nginx:stable-alpine AS runner

# Copy built files to Nginx for serving
COPY --from=base /app/dist /usr/share/nginx/html

# Expose port 80 for Nginx
EXPOSE 80

# Start Nginx
CMD ["nginx", "-g", "daemon off;"]
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ export default [
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-explicit-any": "off",
},
env: { node: true },
},
];
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>포켓네컷</title>
<script
type="text/javascript"
strategy="beforeInteractive"
src="//dapi.kakao.com/v2/maps/sdk.js?appkey=%VITE_KAKAO_MAP_KEY%&libraries=services,clusterer"
></script>
</head>
<body>
<div id="root"></div>
Expand Down
19 changes: 19 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
server {
listen 80;
server_name pocket4cut.link;

# 정적 파일 서빙
location / {
try_files $uri /index.html;
}

# API 및 SSR 요청 프록시 - 기본 요청을 애플리케이션 서버로 프록시
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
Loading

0 comments on commit f81cf99

Please sign in to comment.