refactor: Dockerfile
This commit is contained in:
parent
abc52f0140
commit
6be48d503d
@ -24,15 +24,21 @@ WORKDIR /app
|
|||||||
# Copy package files
|
# Copy package files
|
||||||
COPY ${PROJECT_FOLDER}/package*.json ./
|
COPY ${PROJECT_FOLDER}/package*.json ./
|
||||||
|
|
||||||
# Install all dependencies (use npm install instead of npm ci)
|
# Install all dependencies
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
# Copy source code
|
# Copy source code
|
||||||
COPY ${PROJECT_FOLDER} .
|
COPY ${PROJECT_FOLDER} .
|
||||||
|
|
||||||
|
# ⚠️ 중요: public/runtime-env.js 삭제 (ConfigMap으로 대체)
|
||||||
|
RUN rm -f public/runtime-env.js
|
||||||
|
|
||||||
# Build the application
|
# Build the application
|
||||||
RUN NODE_ENV=production npm run build
|
RUN NODE_ENV=production npm run build
|
||||||
|
|
||||||
|
# ⚠️ 빌드된 파일에서도 runtime-env.js 삭제
|
||||||
|
RUN rm -f dist/runtime-env.js
|
||||||
|
|
||||||
# Production stage
|
# Production stage
|
||||||
FROM nginx:alpine AS production
|
FROM nginx:alpine AS production
|
||||||
|
|
||||||
@ -41,9 +47,12 @@ ARG EXPORT_PORT=18080
|
|||||||
# Copy built files from builder stage
|
# Copy built files from builder stage
|
||||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
# Copy nginx configuration (이미 포트가 18080으로 설정됨)
|
# Copy nginx configuration
|
||||||
COPY deployment/container/nginx.conf /etc/nginx/conf.d/default.conf
|
COPY deployment/container/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
|
# ⚠️ 더미 runtime-env.js 생성 (ConfigMap으로 덮어씌워질 예정)
|
||||||
|
RUN echo "console.log('Runtime config will be loaded from ConfigMap');" > /usr/share/nginx/html/runtime-env.js
|
||||||
|
|
||||||
EXPOSE ${EXPORT_PORT}
|
EXPOSE ${EXPORT_PORT}
|
||||||
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
Loading…
x
Reference in New Issue
Block a user