Skip to content

Commit

Permalink
[INFRA] Setting : Frontend Dockerfile ์ˆ˜์ •
Browse files Browse the repository at this point in the history
  • Loading branch information
404-not-foundl committed Jun 10, 2024
1 parent fe4be80 commit 8cb054d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 25 deletions.
Binary file modified .DS_Store
Binary file not shown.
39 changes: 14 additions & 25 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
# nginx ์ด๋ฏธ์ง€๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๋’ค์— tag๊ฐ€ ์—†์œผ๋ฉด latest ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
FROM nginx:latest

# root ์— app ํด๋”๋ฅผ ์ƒ์„ฑ
RUN mkdir /app

# work dir ๊ณ ์ •
# ๋นŒ๋“œ ์Šคํ…Œ์ด์ง€
FROM node:20 AS build
WORKDIR /app

# work dir ์— dist ํด๋” ์ƒ์„ฑ /app/dist
RUN mkdir ./dist

# host pc์˜ ํ˜„์žฌ๊ฒฝ๋กœ์˜ dist ํด๋”๋ฅผ workdir ์˜ dist ํด๋”๋กœ ๋ณต์‚ฌ
ADD ./dist ./dist

# nginx ์˜ default.conf ๋ฅผ ์‚ญ์ œ
RUN rm /etc/nginx/conf.d/default.conf

# host pc ์˜ default.conf ๋ฅผ ์•„๋ž˜ ๊ฒฝ๋กœ์— ๋ณต์‚ฌ
COPY ./default.conf /etc/nginx/conf.d

# 80 ํฌํŠธ ์˜คํ”ˆ
EXPOSE 80

# container ์‹คํ–‰ ์‹œ ์ž๋™์œผ๋กœ ์‹คํ–‰ํ•  command. nginx ์‹œ์ž‘ํ•จ
CMD ["nginx", "-g", "daemon off;"]
RUN ls -al
COPY package*.json ./
RUN npm install
COPY ./ ./
RUN npm run build
RUN ls -al /app

# ์„œ๋ธŒ ์Šคํ…Œ์ด์ง€
FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 5173
CMD ["nginx", "-g", "daemon off;"]

0 comments on commit 8cb054d

Please sign in to comment.