forked from tianon/docker-brew-ubuntu-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d1f6060
Showing
3 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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). |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CONTRIBUTING.md |
This file contains 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
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 |