본문 바로가기
kubenetes

nerfstuio viewer image build

by kyeongseo.oh 2023. 10. 18.

1. nerfstudio viewer를 빌드한다.

아래 커맨드를 실행하면 build 디렉토리가 생성된다.

git clone https://github.com/nerfstudio-project/nerfstudio.git
cd nerfstudio/nerfstudio/viewer/app/

yum install -y epel-release
yum install -y npm
npm install --global yarn

curl -sL https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh -o install_nvm.sh
bash install_nvm.sh

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

source ~/.bash_profile

nvm install 17.8.0
yarn install

yarn global add serve
yarn build
yum install xsel -y
serve -s build

 

2. Dockerfile 작성

FROM node:14-alpine

# Set the working directory
WORKDIR /app

# Install the necessary packages using apk
RUN apk update && \
    apk add --no-cache bash && \
    apk add --no-cache xsel && \
    npm install -g serve

# Copy the application files
COPY ./app /app

# Command to start the application
CMD ["serve", "-s", "build"]

디렉토리는 다음과 같이 구성하였음

[root@ks1 nerf-viewer]# tree -L 2
.
├── app
│   └── build
└── Dockerfile

 

3.이미지 빌드

docker build -t nerf-studio-viewer .

 

4. nerfstudio viewer 실행

nerfstuio viewer는 3000번 포트로 실행된다. 

docker run -d -p 0.0.0.0:3000:3000 nerf-studio-viewer

 

server-ip:3000으로 접속한다.

 

5.  k8s deployment로 실행

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nerfstudio-viewer-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nerfstudio-viewer
  template:
    metadata:
      labels:
        app: nerfstudio-viewer
    spec:
      containers:
        - name: nerfstudio-viewer-container
          image: ks4.dd.io/custom/nerf-studio-viewer:v1
          ports:
            - containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:
  name: nerfstudio-viewer-service
spec:
  selector:
    app: nerfstudio-viewer
  ports:
    - protocol: TCP
      port: 3000
      targetPort: 3000
  type: NodePort

 

'kubenetes' 카테고리의 다른 글

kubeflow 1.9.0 설치하기  (0) 2024.08.26
coredns에 host 등록하기  (0) 2023.12.21
kubeflow 1.7.0 설치  (0) 2023.08.29
k8s nifi ingress  (0) 2022.10.06
k8s nifi-1.17.0  (0) 2022.10.03

댓글