Add ubuntu

This commit is contained in:
Sam Yaple 2017-01-09 16:40:48 +00:00
parent 02379d1e9a
commit c4bbe0f28f
2 changed files with 35 additions and 0 deletions

23
ubuntu/Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM ubuntu:xenial
ENV VIRTUAL_ENV /virtualenv
ENV PATH "$VIRTUAL_ENV/bin:$PATH"
COPY downloader.sh /
RUN set -x \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
python \
&& curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
&& python get-pip.py \
&& rm get-pip.py \
&& pip install virtualenv \
&& /downloader.sh \
&& virtualenv $VIRTUAL_ENV \
&& hash -r \
&& pip install -c /tmp/packages/upper-constraints.txt --no-compile --find-links /tmp/packages http://tarballs.openstack.org/glance/glance-master.tar.gz \
&& apt-get purge -y --auto-remove \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/* /tmp/* /root/.cache /usr/local/*

12
ubuntu/downloader.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash -eux
DISTRO="ubuntu"
REPO="yaodu/requirements"
TAG="latest-${DISTRO}"
TOKEN=$(curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:${REPO}:pull" | python -c "import sys, json; print json.load(sys.stdin)['token']")
BLOB=$(curl -H "Authorization: Bearer ${TOKEN}" https://registry.hub.docker.com/v2/${REPO}/manifests/${TAG} | python -c "import sys, json; print json.load(sys.stdin)['fsLayers'][0]['blobSum']")
curl -L -H "Authorization: Bearer ${TOKEN}" https://registry.hub.docker.com/v2/${REPO}/blobs/${BLOB} > /tmp/wheels.tar.gz
mkdir /tmp/packages
tar xvf /tmp/wheels.tar.gz -C /tmp/packages/ --strip-components=2 root/packages