Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tianon committed Jun 24, 2014
0 parents commit d1f6060
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# tl;dr: NO PULL REQUESTS PLEASE
## OPEN ISSUES TO DISCUSS CHANGES

Git is not a fan of what we're doing here. To combat this, we use
`git checkout --orphan`, which very effectively discards all the history of
the branch for each tarball. The benefit is much shorter download times,
since there's no big binary history.

Please feel free to open issues and discuss these images. I've
intentionally left the issue tracker here open for just such discussion!
However, please do not submit pull requests. Due to this repo's unique
nature, pull requests are not only impossible to review, but also break the
orphaned history and increase repository clone times for everyone (most
importantly for the [stackbrew](https://github.com/dotcloud/stackbrew)
maintainers who have to test and deploy these images often).
1 change: 1 addition & 0 deletions README.md
58 changes: 58 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash
set -e

cd "$(dirname "$BASH_SOURCE")"

versions=( "$@" )
if [ ${#versions[@]} -eq 0 ]; then
versions=( */ )
fi
versions=( "${versions[@]%/}" )

for v in "${versions[@]}"; do
(
cd "$v"
thisTar="$v-core-amd64.tar.gz"
wget -qN "http://cdimage.ubuntu.com/ubuntu-core/$v/daily/current/"{MD5,SHA{1,256}}SUMS{,.gpg}
wget -N "http://cdimage.ubuntu.com/ubuntu-core/$v/daily/current/$thisTar"
sha256sum="$(sha256sum "$thisTar" | cut -d' ' -f1)"
if ! grep -q "$sha256sum" SHA256SUMS; then
echo >&2 "error: '$thisTar' has invalid SHA256"
exit 1
fi
cat > Dockerfile <<EOF
FROM scratch
ADD $thisTar /
EOF

cat >> Dockerfile <<'EOF'
# a few minor docker-specific tweaks
RUN echo '#!/bin/sh' > /usr/sbin/policy-rc.d \
&& echo 'exit 101' >> /usr/sbin/policy-rc.d \
&& chmod +x /usr/sbin/policy-rc.d \
&& dpkg-divert --local --rename --add /sbin/initctl \
&& ln -sf /bin/true /sbin/initctl \
\
&& echo 'force-unsafe-io' > /etc/dpkg/dpkg.cfg.d/02apt-speedup \
\
&& echo 'DPkg::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' > /etc/apt/apt.conf.d/no-cache \
&& echo 'APT::Update::Post-Invoke { "rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true"; };' >> /etc/apt/apt.conf.d/no-cache \
&& echo 'Dir::Cache::pkgcache ""; Dir::Cache::srcpkgcache "";' >> /etc/apt/apt.conf.d/no-cache \
\
&& echo 'Acquire::Languages "none";' > /etc/apt/apt.conf.d/no-languages
# enable the universe
RUN sed -i 's/^#\s*\(deb.*universe\)$/\1/g' /etc/apt/sources.list
# overwrite this with 'CMD []' in a dependent Dockerfile
CMD ["/bin/bash"]
EOF
)
done

user="$(docker info | awk '/^Username:/ { print $2 }')"
[ -z "$user" ] || user="$user/"
for v in "${versions[@]}"; do
( set -x; docker build -t "${user}ubuntu-core:$v" "$v" )
done

0 comments on commit d1f6060

Please sign in to comment.