Commit 34f65e21 authored by Drew's avatar Drew

Convert to 3-image build environment

This is a lot simpler to work with on resource-constrained devices
parent 7fd1fa5a
FROM debian:latest
MAINTAINER Drew Crawford
ENV SWIFT_TAG="__TAG__" RUNTIME_PACKAGES="clang libedit2 libpython2.7 libxml2 libicu52" BUILDTIME_PACKAGES="git ca-certificates python ninja-build cmake uuid-dev libbsd-dev libicu-dev pkg-config libedit-dev file libxml2-dev python-dev libncurses5-dev libsqlite3-dev libreadline6-dev rsync"
#apply patches here
# ADD SR-437.patch /
# Create a directory to work in
RUN mkdir swift-dev
WORKDIR /swift-dev
# Install the runtime and build-time dependencies
RUN apt-get update
RUN apt-get install $RUNTIME_PACKAGES $BUILDTIME_PACKAGES -y --no-install-recommends
RUN git clone
WORKDIR /swift-dev/swift
# submodules? Where we're going, we don't need submodules!
RUN ./utils/update-checkout --clone
# The silly update-checkout script does not understand matching the swift checkout ref
# In practice what you're supposed to do (I think! It's not documented!) is check out the same snapshot tag
# Not all the folders have them (where do some of them come from??) but we'll just try them all
# see
ADD /swift-dev/
RUN bash /swift-dev/
# Apply patches here
# cd ../swift-corelibs-foundation
# git apply < /SR-437.patch
# cat Foundation/NSPathUtilities.swift
# And now we build, like a good little linuxen.
# I believe this is what the linux build script does. In practice, this builds a system into /tmp/install and then tars it up.
RUN ./utils/build-script --preset=buildbot_linux install_destdir="/tmp/install" installable_package="/tmp/swift.tar.gz"
......@@ -4,15 +4,19 @@ echo "Type tag name"
read tag
sed "s/__TAG__/$tag/" Dockerfile > Dockerfile.tagged
sed "s/__TAG__/$tag/" build.dockerfile > Dockerfile.tagged
docker build -f Dockerfile.tagged -t swift-tmp .
docker save swift-tmp > $WORKDIR/swift_tmp.tar
#figure out where to use from
FROM=`docker history -q swift-tmp | tail -n 3 | head -n 1`
sudo docker-squash -from $FROM -i "$WORKDIR/swift_tmp.tar" -o "$WORKDIR/swift_squashed.tar" -t $username/swift:$tag
docker load -i $WORKDIR/swift_squashed.tar
echo "Moving swift.tar.gz to new container..."
id=$(docker create swift-tmp)
docker cp $id:/tmp/swift.tar.gz .
rm -rf fakeroot
mkdir -p fakeroot/usr/local
tar xf swift.tar.gz -C fakeroot/usr/local --strip-components 1
tar cf swift-local.tar.gz -C fakeroot .
rm -rf fakeroot
docker build -f swift.dockerfile -t $username/swift:$tag .
docker tag $username/swift:$tag $username/swift:latest
echo "Building runtime image..."
id=$(docker create drewcrawford/swift:latest)
docker cp $id:usr/local/lib/swift - > swiftlibs.tar
docker build -f Runtime.dockerfile -t $username/swift-runtime:latest .
FROM debian:latest
MAINTAINER Drew Crawford
RUN apt-get update && apt-get install --no-install-recommends -y clang libedit2 libpython2.7 libxml2 libicu52 && rm -rf rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ADD swift-local.tar.gz /
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment