码迷,mamicode.com
首页 > 编程语言 > 详细

分析脚本搭建docker环境:python, R

时间:2019-09-05 18:11:18      阅读:115      评论:0      收藏:0      [点我收藏+]

标签:bsp   eve   packages   gdi   shanghai   ash   tin   update   x86   

 

1. 搭建Anaconda Python3.6

FROM nvidia/cuda:8.0-cudnn6-devel-ubuntu16.04
MAINTAINER Tyan <tyan.liu.git@gmail.com>


# Install basic dependencies
RUN apt-get update && apt-get install -y --no-install-recommends         build-essential         cmake         git         wget         libopencv-dev         libsnappy-dev         python-dev         python-pip         tzdata         vim


# Install anaconda for python 3.6
RUN wget --quiet https://repo.continuum.io/archive/Anaconda3-5.0.1-Linux-x86_64.sh -O ~/anaconda.sh &&     /bin/bash ~/anaconda.sh -b -p /opt/conda &&     rm ~/anaconda.sh &&     echo "export PATH=/opt/conda/bin:$PATH" >> ~/.bashrc


# Set timezone
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime


# Set locale
ENV LANG C.UTF-8 LC_ALL=C.UTF-8


# Initialize workspace
RUN mkdir /workspace
WORKDIR /workspace

 

2. dockerfile 安装python包

COPY requirements.txt /tmp/
RUN pip install --requirement /tmp/requirements.txt
COPY . /tmp/

 

3. 搭建R环境

FROM r-base


# 安装包
RUN R -e "install.packages(‘remotes‘); remotes::install_version(‘tidystringdist‘, ‘0.1.2‘)"

RUN mkdir /home/analysis
COPY myscript.R /home/analysis/myscript.R

# 运行
CMD cd /home/analysis && R -e "source(‘myscript.R‘)" && mv /home/analysis/p.csv /home/results/p.csv

 已有R的docker image:  https://github.com/rocker-org/rocker

分析脚本搭建docker环境:python, R

标签:bsp   eve   packages   gdi   shanghai   ash   tin   update   x86   

原文地址:https://www.cnblogs.com/snow-backup/p/11468705.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!