zoukankan      html  css  js  c++  java
  • 分析脚本搭建docker环境:python, R

    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

  • 相关阅读:
    About Me
    洛谷 P2633 Count on a tree
    【题解】牛客编程巅峰赛S1赛季第1场
    洛谷 P4132 [BJOI2012]算不出的等式
    洛谷 P5970 [POI2016]Nim z utrudnieniem
    DP没入门就入土
    洛谷 P4042 [AHOI2014/JSOI2014]骑士游戏
    洛谷 P3592 [POI2015]MYJ
    51Nod 1683 最短路
    51Nod 1327 棋盘游戏
  • 原文地址:https://www.cnblogs.com/snow-backup/p/11468705.html
Copyright © 2011-2022 走看看