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 \
ca-certificates \
curl \
libdatetime-perl \
libgcrypt20-dev \
libglib2.0-0 \
libnotify4 \
libnotify-bin \
libwww-perl \
perl \
wget \
&& rm -rf /var/lib/apt/lists/*
RUN apk --no-cache add \
ca-certificates
ENV HOME /home/user
RUN useradd --create-home --home-dir $HOME user \
RUN adduser -u 1001 -D user \
&& mkdir -p $HOME/.irssi \
&& chown -R user:user $HOME
ENV LANG C.UTF-8
# gpg: key DDBEF0E1: public key "The Irssi project <staff@irssi.org>" imported
RUN gpg --keyserver pool.sks-keyservers.net --recv-keys 7EE65E3082A5FB06AC7C368D00CCB587DDBEF0E1
ENV IRSSI_VERSION 0.8.19
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
ENV LIB_OTR_VERSION 4.1.0
ENV IRSSI_OTR_VERSION 1.0.0
RUN buildDeps=' \
RUN set -x \
&& apk add --no-cache --virtual .build-deps \
autoconf \
automake \
bzip2 \
libglib2.0-dev \
libncurses-dev \
libperl-dev \
libssl-dev \
ca-certificates \
gcc \
glib-dev \
gnupg \
libc-dev \
libgcrypt-dev \
libtool \
lynx \
make \
pkg-config \
' \
&& set -x \
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& curl -fsSL "https://github.com/irssi-import/irssi/releases/download/${IRSSI_VERSION}/irssi-${IRSSI_VERSION}.tar.bz2" -o /tmp/irssi.tar.bz2 \
&& curl -fsSL "https://github.com/irssi-import/irssi/releases/download/${IRSSI_VERSION}/irssi-${IRSSI_VERSION}.tar.bz2.sig" -o /tmp/irssi.tar.bz2.sig \
&& gpg --verify /tmp/irssi.tar.bz2.sig \
&& mkdir -p /usr/src/irssi \
&& tar -xjf /tmp/irssi.tar.bz2 -C /usr/src/irssi --strip-components 1 \
&& rm /tmp/irssi.tar.bz2* \
&& cd /usr/src/irssi \
&& ./configure \
--enable-true-color \
--prefix="/usr" \
--with-bot \
--with-proxy \
--with-socks \
&& make \
&& make install \
&& curl -sSL "https://otr.cypherpunks.ca/libotr-${LIB_OTR_VERSION}.tar.gz" -o /tmp/libotr.tar.gz \
&& curl -sSL "https://otr.cypherpunks.ca/libotr-${LIB_OTR_VERSION}.tar.gz.asc" -o /tmp/libotr.tar.gz.asc \
&& curl -sSL "https://otr.cypherpunks.ca/gpgkey.asc" | gpg --import \
&& gpg --verify /tmp/libotr.tar.gz.asc \
ncurses-dev \
openssl-dev \
patch \
perl-dev \
pkgconf \
tar \
xz \
&& wget "https://github.com/irssi/irssi/releases/download/${IRSSI_VERSION}/irssi-${IRSSI_VERSION}.tar.xz" -O /tmp/irssi.tar.xz \
&& wget "https://github.com/irssi/irssi/releases/download/${IRSSI_VERSION}/irssi-${IRSSI_VERSION}.tar.xz.asc" -O /tmp/irssi.tar.xz.asc \
&& export GNUPGHOME="$(mktemp -d)" \
# gpg: key DDBEF0E1: public key "The Irssi project <staff@irssi.org>" imported
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 7EE65E3082A5FB06AC7C368D00CCB587DDBEF0E1 \
&& gpg --batch --verify /tmp/irssi.tar.xz.asc /tmp/irssi.tar.xz \
&& rm -r "$GNUPGHOME" /tmp/irssi.tar.xz.asc \
&& mkdir -p /usr/src \
&& tar -xJf /tmp/irssi.tar.xz -C /usr/src \
&& rm /tmp/irssi.tar.xz \
&& ( \
cd /usr/src/irssi-$IRSSI_VERSION \
&& ./configure \
--enable-true-color \
--with-bot \
--with-proxy \
--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 \
&& tar -xzf /tmp/libotr.tar.gz -C /usr/src/libotr --strip-components 1 \
&& rm /tmp/libotr.tar.gz* \
&& cd /usr/src/libotr \
&& ./configure --with-pic --prefix=/usr \
&& make \
&& make install \
&& rm /tmp/libotr.tar.gz \
&& ( \
cd /usr/src/libotr \
&& ./configure \
--with-pic \
--prefix=/usr \
&& make \
&& make install \
) \
&& 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 \
&& cd /usr/src/irssi-otr \
&& ./bootstrap \
&& ./configure --prefix="/usr" \
&& make \
&& make install \
&& rm -rf /usr/src/irssi* \
&& rm -rf /usr/src/libotr* \
&& apt-get purge -y --auto-remove $buildDeps
&& wget "https://github.com/cryptodotis/irssi-otr/archive/v${IRSSI_OTR_VERSION}.tar.gz" -O /tmp/irssi-otr.tar.gz \
&& mkdir -p /usr/src/irssi-otr \
&& tar -xf /tmp/irssi-otr.tar.gz -C /usr/src/irssi-otr --strip-components 1 \
&& rm /tmp/irssi-otr.tar.gz \
&& ( \
cd /usr/src/irssi-otr \
&& wget "$PATCH_FOR_IRSSI_OTR" -O patch.diff \
&& patch -p1 < patch.diff \
&& ./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
VOLUME $HOME/.irssi
USER user
CMD ["irssi"]

View File

@ -32,9 +32,10 @@ RUN apt-get update && apt-get install -y \
--no-install-recommends \
&& 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
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++