Signed-off-by: Jess Frazelle <jess@mesosphere.com>
This commit is contained in:
Jess Frazelle 2016-04-18 19:55:37 -07:00
parent 19a62e5938
commit 98d2177812
No known key found for this signature in database
GPG Key ID: 18F3685C0022BFF3
7 changed files with 193 additions and 66 deletions

4
coreos/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
coreos_production_*.iso
coreos_production_*.bin
coreos_production_*.bin*
version.txt

42
coreos/Dockerfile.build Normal file
View File

@ -0,0 +1,42 @@
FROM debian:jessie
ENV HOME /home/user
RUN useradd --create-home --shell /bin/bash --home-dir $HOME user
RUN apt-get update && apt-get install -y \
bzip2 \
ca-certificates \
curl \
git \
gnupg \
python \
sudo \
tar \
xz-utils \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
COPY version.txt /home/user/
RUN git config --global user.email "no-reply@coreos.com" \
&& git config --global user.name "CoreOS Build SDK" \
&& curl -sSL https://storage.googleapis.com/git-repo-downloads/repo -o /usr/local/bin/repo \
&& chmod a+x /usr/local/bin/repo \
&& mkdir -p $HOME/coreos \
&& ( \
cd $HOME/coreos \
&& repo init -u https://github.com/coreos/manifest.git \
&& repo sync \
) \
&& adduser user sudo \
&& passwd -d user \
&& ln -snvf /dev/true /sbin/modprobe \
&& echo "sudo rootfs.sh" > $HOME/.bash_history \
&& chown -R user:user $HOME
COPY rootfs.sh /usr/local/bin/
WORKDIR $HOME
USER user
CMD ["bash"]

31
coreos/Makefile Normal file
View File

@ -0,0 +1,31 @@
.PHONY: build_rootfs_image rootfs clean
BASE := http://stable.release.core-os.net/amd64-usr/current
COREOS_IMAGE := coreos_production_image.bin.bz2
DECOMPRESSED_COREOS_IMAGE := $(COREOS_IMAGE:.bz2=)
VERSION_FILE := version.txt
DOCKER_BUILD_ROOTFS_IMAGE := coreos:build
all: rootfs
$(COREOS_IMAGE):
@gpget -O -b -url "$(BASE)/$(COREOS_IMAGE)"
$(DECOMPRESSED_COREOS_IMAGE): $(COREOS_IMAGE)
@bzip2 -d "$(COREOS_IMAGE)"
$(VERSION_FILE):
@gpget -O -b -url "$(BASE)/$(VERSION_FILE)"
build_rootfs_image: $(VERSION_FILE)
@docker build --rm --force-rm -f Dockerfile.build -t $(DOCKER_BUILD_ROOTFS_IMAGE) .
rootfs: build_rootfs_image
@sudo modprobe fuse
@docker run --rm -it --privileged -v $(CURDIR):/images $(DOCKER_BUILD_ROOTFS_IMAGE) bash
clean:
$(RM) $(COREOS_IMAGE) $(DECOMPRESSED_COREOS_IMAGE) $(VERSION_FILE)

Binary file not shown.

26
coreos/rootfs.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
set -e
source /home/user/version.txt
for i in {0..7}; do
if [[ ! -e /dev/loop$i ]]; then
sudo /bin/mknod -m640 /dev/loop$i b 7 $i
sudo /bin/chown root:disk /dev/loop$i
else
echo "/dev/loop$i exists"
fi
done
(
cd /home/user/coreos
./chromite/bin/cros_sdk
exit
./chromite/bin/cros_sdk --enter
./set_shared_user_password.sh
./setup_board --default --board=amd64-usr
./build_packages
./build_image --base_dev_pkg coreos-base/coreos container
)
#XZ_OPT=-9 tar cvJf "/images/coreos-${COREOS_VERSION}.tar.xz" .

View File

@ -1,86 +1,109 @@
FROM debian:jessie FROM alpine:3.3
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apk --no-cache add \
ca-certificates \ ca-certificates
curl \
libdatetime-perl \
libgcrypt20-dev \
libglib2.0-0 \
libnotify4 \
libnotify-bin \
libwww-perl \
perl \
wget \
&& rm -rf /var/lib/apt/lists/*
ENV HOME /home/user ENV HOME /home/user
RUN useradd --create-home --home-dir $HOME user \ RUN adduser -u 1001 -D user \
&& mkdir -p $HOME/.irssi \ && mkdir -p $HOME/.irssi \
&& chown -R user:user $HOME && chown -R user:user $HOME
ENV LANG C.UTF-8 ENV LANG C.UTF-8
# gpg: key DDBEF0E1: public key "The Irssi project <staff@irssi.org>" imported ENV IRSSI_VERSION 0.8.19
RUN gpg --keyserver pool.sks-keyservers.net --recv-keys 7EE65E3082A5FB06AC7C368D00CCB587DDBEF0E1 ENV LIB_OTR_VERSION 4.1.1
ENV IRSSI_OTR_VERSION 1.0.1
ENV PATCH_FOR_IRSSI_OTR https://github.com/cryptodotis/irssi-otr/commit/d03ab59b6f27142c1c5e99fedc635a589b1607bb.diff
ENV IRSSI_VERSION 0.8.17 RUN set -x \
ENV LIB_OTR_VERSION 4.1.0 && apk add --no-cache --virtual .build-deps \
ENV IRSSI_OTR_VERSION 1.0.0
RUN buildDeps=' \
autoconf \ autoconf \
automake \ automake \
bzip2 \ ca-certificates \
libglib2.0-dev \ gcc \
libncurses-dev \ glib-dev \
libperl-dev \ gnupg \
libssl-dev \ libc-dev \
libgcrypt-dev \
libtool \ libtool \
lynx \ lynx \
make \ make \
pkg-config \ ncurses-dev \
' \ openssl-dev \
&& set -x \ patch \
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends \ perl-dev \
&& rm -rf /var/lib/apt/lists/* \ pkgconf \
&& curl -fsSL "https://github.com/irssi-import/irssi/releases/download/${IRSSI_VERSION}/irssi-${IRSSI_VERSION}.tar.bz2" -o /tmp/irssi.tar.bz2 \ tar \
&& curl -fsSL "https://github.com/irssi-import/irssi/releases/download/${IRSSI_VERSION}/irssi-${IRSSI_VERSION}.tar.bz2.sig" -o /tmp/irssi.tar.bz2.sig \ xz \
&& gpg --verify /tmp/irssi.tar.bz2.sig \ && wget "https://github.com/irssi/irssi/releases/download/${IRSSI_VERSION}/irssi-${IRSSI_VERSION}.tar.xz" -O /tmp/irssi.tar.xz \
&& mkdir -p /usr/src/irssi \ && wget "https://github.com/irssi/irssi/releases/download/${IRSSI_VERSION}/irssi-${IRSSI_VERSION}.tar.xz.asc" -O /tmp/irssi.tar.xz.asc \
&& tar -xjf /tmp/irssi.tar.bz2 -C /usr/src/irssi --strip-components 1 \ && export GNUPGHOME="$(mktemp -d)" \
&& rm /tmp/irssi.tar.bz2* \ # gpg: key DDBEF0E1: public key "The Irssi project <staff@irssi.org>" imported
&& cd /usr/src/irssi \ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 7EE65E3082A5FB06AC7C368D00CCB587DDBEF0E1 \
&& ./configure \ && gpg --batch --verify /tmp/irssi.tar.xz.asc /tmp/irssi.tar.xz \
--enable-true-color \ && rm -r "$GNUPGHOME" /tmp/irssi.tar.xz.asc \
--prefix="/usr" \ && mkdir -p /usr/src \
--with-bot \ && tar -xJf /tmp/irssi.tar.xz -C /usr/src \
--with-proxy \ && rm /tmp/irssi.tar.xz \
--with-socks \ && ( \
&& make \ cd /usr/src/irssi-$IRSSI_VERSION \
&& make install \ && ./configure \
&& curl -sSL "https://otr.cypherpunks.ca/libotr-${LIB_OTR_VERSION}.tar.gz" -o /tmp/libotr.tar.gz \ --enable-true-color \
&& curl -sSL "https://otr.cypherpunks.ca/libotr-${LIB_OTR_VERSION}.tar.gz.asc" -o /tmp/libotr.tar.gz.asc \ --with-bot \
&& curl -sSL "https://otr.cypherpunks.ca/gpgkey.asc" | gpg --import \ --with-proxy \
&& gpg --verify /tmp/libotr.tar.gz.asc \ --with-socks \
--prefix=/usr \
&& make -j$(getconf _NPROCESSORS_ONLN) \
&& make install \
) \
&& wget "https://otr.cypherpunks.ca/libotr-${LIB_OTR_VERSION}.tar.gz" -O /tmp/libotr.tar.gz \
&& wget "https://otr.cypherpunks.ca/libotr-${LIB_OTR_VERSION}.tar.gz.asc" -O /tmp/libotr.tar.gz.asc \
&& export GNUPGHOME="$(mktemp -d)" \
# gpg: key 42C2ABAD: public key "OTR Dev Team (Signing Key) <otr@cypherpunks.ca>" imported
&& gpg --keyserver pgp.mit.edu --recv-keys 22DF3305DF56667CE15784FCF24DE08F42C2ABAD \
&& gpg --batch --verify /tmp/libotr.tar.gz.asc /tmp/libotr.tar.gz \
&& rm -r "$GNUPGHOME" /tmp/libotr.tar.gz.asc \
&& mkdir -p /usr/src/libotr \ && mkdir -p /usr/src/libotr \
&& tar -xzf /tmp/libotr.tar.gz -C /usr/src/libotr --strip-components 1 \ && tar -xzf /tmp/libotr.tar.gz -C /usr/src/libotr --strip-components 1 \
&& rm /tmp/libotr.tar.gz* \ && rm /tmp/libotr.tar.gz \
&& cd /usr/src/libotr \ && ( \
&& ./configure --with-pic --prefix=/usr \ cd /usr/src/libotr \
&& make \ && ./configure \
&& make install \ --with-pic \
--prefix=/usr \
&& make \
&& make install \
) \
&& mkdir -p /usr/src/irssi-otr \ && mkdir -p /usr/src/irssi-otr \
&& curl -sSL "https://github.com/cryptodotis/irssi-otr/archive/v${IRSSI_OTR_VERSION}.tar.gz" | tar -vxz --strip-components 1 -C /usr/src/irssi-otr \ && wget "https://github.com/cryptodotis/irssi-otr/archive/v${IRSSI_OTR_VERSION}.tar.gz" -O /tmp/irssi-otr.tar.gz \
&& cd /usr/src/irssi-otr \ && mkdir -p /usr/src/irssi-otr \
&& ./bootstrap \ && tar -xf /tmp/irssi-otr.tar.gz -C /usr/src/irssi-otr --strip-components 1 \
&& ./configure --prefix="/usr" \ && rm /tmp/irssi-otr.tar.gz \
&& make \ && ( \
&& make install \ cd /usr/src/irssi-otr \
&& rm -rf /usr/src/irssi* \ && wget "$PATCH_FOR_IRSSI_OTR" -O patch.diff \
&& rm -rf /usr/src/libotr* \ && patch -p1 < patch.diff \
&& apt-get purge -y --auto-remove $buildDeps && ./bootstrap \
&& ./configure \
--prefix=/usr \
&& make \
&& make install \
) \
&& rm -rf /usr/src/irssi-$IRSSI_VERSION \
&& rm -rf /usr/src/libotr \
&& rm -rf /usr/src/irssi-otr \
&& runDeps="$( \
scanelf --needed --nobanner --recursive /usr \
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
| sort -u \
| xargs -r apk info --installed \
| sort -u \
)" \
&& apk add --no-cache --virtual .irssi-rundeps $runDeps perl-libwww \
&& apk del .build-deps
WORKDIR $HOME WORKDIR $HOME
VOLUME $HOME/.irssi
USER user USER user
CMD ["irssi"] CMD ["irssi"]

View File

@ -32,9 +32,10 @@ RUN apt-get update && apt-get install -y \
--no-install-recommends \ --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
ADD https://get.docker.com/builds/Linux/x86_64/docker-latest /usr/bin/docker
RUN chmod +x /usr/bin/docker \ RUN curl -sSL https://get.docker.com/builds/Linux/x86_64/docker-latest.tgz | tar -xvz \
-C /usr/bin --strip-components 1 \
&& chmod +x /usr/bin/docker* \
&& echo "docker daemon -D -s overlay" > $HOME/.bash_history && echo "docker daemon -D -s overlay" > $HOME/.bash_history
ENV CCACHE_MAXSIZE=20G CCACHE_CPP2=true CCACHE_HARDLINK=true CCACHE_SLOPPINESS=file_macro,time_macros,include_file_mtime,include_file_ctime,file_stat_matches CC=/usr/bin/clang CXX=/usr/bin/clang++ ENV CCACHE_MAXSIZE=20G CCACHE_CPP2=true CCACHE_HARDLINK=true CCACHE_SLOPPINESS=file_macro,time_macros,include_file_mtime,include_file_ctime,file_stat_matches CC=/usr/bin/clang CXX=/usr/bin/clang++