Created
October 22, 2018 08:41
-
-
Save fenchu/14b8fe5a0c24942f845a35106c7b176a to your computer and use it in GitHub Desktop.
Pyenv in docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:16.04 | |
MAINTAINER Morten Bjoernsvik <[email protected]> | |
ARG LANG=nb_NO.UTF-8 | |
ENV LANG ${LANG} | |
ARG TZ=Europe/Oslo | |
ENV TZ ${TZ} | |
ARG MYHOME=/root | |
ENV MYHOME ${MYHOME} | |
ARG PYTHONVER=3.7.1 | |
ENV PYTHONVER ${PYTHONVER} | |
ARG PYTHONNAME=pythontest | |
ENV PYTHONNAME ${PYTHONNAME} | |
# Add perforce | |
RUN echo "deb http://package.perforce.com/apt/ubuntu/ xenial release" > /etc/apt/sources.list.d/perforce.list && \ | |
wget -qO - https://package.perforce.com/perforce.pubkey | apt-key add - | |
RUN apt-get update && apt-get upgrade -y && apt-get install -y locales wget git curl zip vim apt-transport-https tzdata language-pack-nb language-pack-nb-base manpages \ | |
build-essential libjpeg-dev libssl-dev zlib1g-dev libbz2-dev libreadline-dev libreadline6-dev libsqlite3-dev tk-dev libffi-dev libpng-dev libfreetype6-dev helix-cli | |
RUN echo "nb_NO.UTF-8 UTF-8" > /etc/locale.gen && \ | |
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \ | |
locale-gen && \ | |
update-locale LANG=nb_NO.UTF-8 && \ | |
echo "LANG=nb_NO.UTF-8" > /etc/default/locale && \ | |
echo "LC_ALL=nb_NO.UTF-8" >> /etc/default/locale | |
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | |
RUN git clone https://github.com/pyenv/pyenv.git ${MYHOME}/.pyenv && \ | |
git clone https://github.com/yyuu/pyenv-virtualenv.git ${MYHOME}/.pyenv/plugins/pyenv-virtualenv && \ | |
git clone git://github.com/pyenv/pyenv-update.git ${MYHOME}/.pyenv/plugins/pyenv-update | |
SHELL ["/bin/bash", "-c", "-l"] | |
COPY ./.bash_profile /tmp/ | |
RUN cat /tmp/.bash_profile >> ${MYHOME}/.bashrc && \ | |
cat /tmp/.bash_profile >> ${MYHOME}/.bash_profile && \ | |
rm -f /tmp/.bash_profile && \ | |
source ${MYHOME}/.bash_profile && \ | |
pyenv install ${PYTHONVER} && \ | |
pyenv virtualenv ${PYTHONVER} ${PYTHONNAME} && \ | |
pyenv global ${PYTHONNAME} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#build
This is configured for my usecase with perforce and norwegian localization but can easily be fixed
If you use this as base for your projects and use
SHELL ["/bin/bash", "-c", "-l"]
it will use this python version: