Skip to content

Commit

Permalink
use pipenv in image building dockerfile (kubeflow#36)
Browse files Browse the repository at this point in the history
* use pipenv to install packages and remove requirements.txt
  • Loading branch information
jimexist authored and jlewi committed Mar 28, 2018
1 parent d1b994c commit 4f8a605
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 79 deletions.
70 changes: 37 additions & 33 deletions images/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,41 @@ FROM ubuntu:xenial
MAINTAINER Jeremy Lewi

# Never prompt the user for choices on installation/configuration of packages
ENV DEBIAN_FRONTEND noninteractive
ENV TERM linux
ENV DEBIAN_FRONTEND=noninteractive
ENV TERM=linux
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8

# gcc & python-dev are needed so we can install crcmod for gsutil
# also includes installations for Python3
RUN set -ex \
&& apt-get update -yqq \
&& apt-get install -yqq --no-install-recommends \
build-essential \
curl \
locales \
wget \
ca-certificates \
git \
zip \
unzip \
gcc \
ssh \
python-dev \
python-setuptools \
python-pip \
python3-dev \
python3-setuptools \
python3-pip \
build-essential \
curl \
locales \
wget \
ca-certificates \
git \
zip \
unzip \
gcc \
python-dev \
python-setuptools \
python-pip \
python3-dev \
python3-setuptools \
python3-pip \
&& python -V \
&& python3 -V \
&& apt-get clean \
&& rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/* \
/usr/share/man \
/usr/share/doc \
/usr/share/doc-base
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/* \
/usr/share/man \
/usr/share/doc \
/usr/share/doc-base

# Install go
RUN cd /tmp && \
Expand All @@ -52,10 +53,10 @@ RUN wget -q https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.ta
tar xzf google-cloud-sdk.tar.gz -C / && \
rm google-cloud-sdk.tar.gz && \
/google-cloud-sdk/install.sh \
--disable-installation-options \
--bash-completion=false \
--path-update=false \
--usage-reporting=false && \
--disable-installation-options \
--bash-completion=false \
--path-update=false \
--usage-reporting=false && \
gcloud components install alpha beta kubectl

# Install Helm
Expand All @@ -82,7 +83,7 @@ RUN curl -sS http://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
# Install glide
RUN cd /tmp && \
wget -O glide-v0.13.0-linux-amd64.tar.gz \
https://github.com/Masterminds/glide/releases/download/v0.13.0/glide-v0.13.0-linux-amd64.tar.gz && \
https://github.com/Masterminds/glide/releases/download/v0.13.0/glide-v0.13.0-linux-amd64.tar.gz && \
tar -xvf glide-v0.13.0-linux-amd64.tar.gz && \
mv ./linux-amd64/glide /usr/local/bin/

Expand All @@ -103,13 +104,16 @@ RUN cd /tmp && \
rm -rf /tmp/v0.9.5.tar.gz && \
rm -rf /tmp/jsonnet-0.9.5

COPY ./requirements.txt /tmp/requirements.txt
COPY ./Pipfile ./Pipfile.lock /tmp/

# Install various python libraries for both Python 2 and 3 (for now)
RUN pip install -U pip wheel && \
pip install -r /tmp/requirements.txt && \
RUN cd /tmp/ && \
pip install -U pip wheel && \
pip install pipenv && \
pipenv install --system --two && \
pip3 install -U pip wheel && \
pip3 install -r /tmp/requirements.txt
pip3 install pipenv && \
pipenv install --system --three

COPY checkout.sh /usr/local/bin
RUN chmod a+x /usr/local/bin/checkout.sh
Expand Down
42 changes: 0 additions & 42 deletions images/requirements.txt

This file was deleted.

5 changes: 1 addition & 4 deletions py/kubeflow/testing/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import os
import re
import subprocess
import tempfile
import time
import urllib
import yaml
Expand All @@ -31,7 +30,7 @@ def run(command, cwd=None, env=None, polling_interval=datetime.timedelta(seconds
"""Run a subprocess.
Any subprocess output is emitted through the logging modules.
Returns:
output: A string containing the output.
"""
Expand All @@ -47,8 +46,6 @@ def run(command, cwd=None, env=None, polling_interval=datetime.timedelta(seconds
lines.append("{0}={1}".format(k, env[k]))
logging.info("Running: Environment:\n%s", "\n".join(lines))

log_file = None

process = subprocess.Popen(
command, cwd=cwd, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

Expand Down

0 comments on commit 4f8a605

Please sign in to comment.