Python Code

딥러닝 Pytorch&PostgresSQL 도커파일

Kimhj 2023. 10. 12. 12:22
  • Dockerfile딥러닝 모델링을 위한 환경 구축 도커 파일로, Pytorch 와 Poststres 를 활용하는 예시 코
  • requirements.txt : 도커환경에 필요한 패키지들 목록을 정리한 파일
  • 컨테이너 RUN 후에 mount 필요

 

FROM pytorch/pytorch:1.11.0-cuda11.3-cudnn8-devel
RUN mkdir -p /source
COPY ./requirements.txt /source
#WORKDIR /source

RUN chmod 777 /tmp
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A4B469963BF863CC
RUN apt-get update
RUN apt-get -y install sudo dialog apt-utils aptitude
RUN apt-get install -y software-properties-common vim net-tools ssh lsb-release libbz2-dev 

RUN sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install postgresql

RUN pip install --upgrade pip
RUN pip install -r /source/requirements.txt