Skip to content

Commit

Permalink
Merge pull request #162 from boostcampwm-2024/feature/docker-front
Browse files Browse the repository at this point in the history
도커 스크립트 빌드 오류 수정 및 허브 이미지 업로드 기능 추가
  • Loading branch information
SeoGeonhyuk authored Nov 28, 2024
2 parents 56f5f9e + 9beb96d commit 0509074
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 24 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,22 @@ jobs:
uses: docker/build-push-action@v3
with:
context: .
file: ./apps/client/Dockerfile
file: ./apps/front/Dockerfile
push: true
tags: |
cloud-canvas.kr.ncr.ntruss.com/front:dev
cloud-canvas.kr.ncr.ntruss.com/front:${{ github.sha }}
- name: Docker front-hub image build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./apps/hub/Dockerfile
push: true
tags: |
cloud-canvas.kr.ncr.ntruss.com/front-hub:dev
cloud-canvas.kr.ncr.ntruss.com/front-hub:${{ github.sha }}
- name: Docker back image build and push
uses: docker/build-push-action@v3
with:
Expand Down
42 changes: 29 additions & 13 deletions apps/client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
FROM node:20 AS development
WORKDIR /development
COPY ./pnpm-lock.yaml ./apps/client/package.json .
RUN npm install -g pnpm && pnpm install
# FROM node:20 AS development
# WORKDIR /development
# COPY ./pnpm-lock.yaml ./apps/client/package.json .
# RUN npm install -g pnpm && pnpm install

# FROM node:20 AS build
# WORKDIR /build
# RUN mkdir -p /build/apps/client
# RUN mkdir -p /build/config
# COPY --from=development /development/node_modules/ /build/apps/client/node_modules
# COPY --from=development /development/pnpm-lock.yaml /build/apps/client/
# RUN npm install -g pnpm typescript
# COPY ./config/ /build/config/
# COPY ./apps/client/ /build/apps/client/
# WORKDIR /build/apps/client
# RUN npm run build && rm -rf node_modules && pnpm install --frozen-lockfile --prod

# FROM nginx:alpine AS production
# COPY --from=build /build/apps/client/dist /usr/share/nginx/html
# COPY ./apps/nginx/nginx.conf /etc/nginx/conf.d/default.conf

# ENV PORT=5000
# EXPOSE 5000
# CMD ["nginx", "-g", "daemon off;"]

FROM node:20 AS build

WORKDIR /build
RUN mkdir -p /build/apps/client
RUN mkdir -p /build/config
COPY --from=development /development/node_modules/ /build/apps/client/node_modules
COPY --from=development /development/pnpm-lock.yaml /build/apps/client/
RUN npm install -g pnpm typescript
COPY ./config/ /build/config/
COPY ./apps/client/ /build/apps/client/
WORKDIR /build/apps/client
RUN npm run build && rm -rf node_modules && pnpm install --frozen-lockfile --prod

COPY . .

RUN npm install -g pnpm && pnpm install && pnpm build

FROM nginx:alpine AS production
COPY --from=build /build/apps/client/dist /usr/share/nginx/html
Expand Down
20 changes: 10 additions & 10 deletions docker-composes/cloud-canvas-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@ services:
- cloud-canvas-network
restart: unless-stopped

# front:
# build:
# context: ../
# dockerfile: apps/client/Dockerfile
# container_name: front
# ports:
# - '5001:5000'
# networks:
# - cloud-canvas-network
# restart: unless-stopped
front:
build:
context: ../
dockerfile: apps/client/Dockerfile
container_name: front
ports:
- '5001:5000'
networks:
- cloud-canvas-network
restart: unless-stopped

fluentd:
build: ./monitorin/logging/fluentd/
Expand Down

0 comments on commit 0509074

Please sign in to comment.