mirror of
https://github.com/wahyd4/s6-builder.git
synced 2026-08-08 20:45:19 +10:00
Initial with a working Dockerfile and README
Signed-off-by: kfei <kfei@kfei.net>
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
FROM base/archlinux
|
||||
|
||||
MAINTAINER kfei <kfei@kfei.net>
|
||||
|
||||
RUN pacman -Syy && \
|
||||
pacman -S --noconfirm --quiet --needed base-devel curl libunistring && \
|
||||
pacman -S --noconfirm --quiet --needed --asdeps git jshon expac
|
||||
|
||||
ADD build.sh /build.sh
|
||||
|
||||
ENTRYPOINT ["/build.sh"]
|
||||
|
||||
VOLUME /dist
|
||||
@@ -0,0 +1,35 @@
|
||||
# s6-builder
|
||||
|
||||
This repository is just for building a Docker image which builds
|
||||
[s6](http://skarnet.org/software/s6/). Also a place to store the built binaries
|
||||
so that I can easily add them to other images.
|
||||
|
||||
## Build
|
||||
|
||||
Build the Docker image:
|
||||
```bash
|
||||
git clone https://github.com/kfei/s6-builder
|
||||
cd s6-builder
|
||||
docker build -t s6-builder .
|
||||
```
|
||||
|
||||
Use that image to build s6 and its dependencies:
|
||||
```bash
|
||||
mkdir dist
|
||||
docker run -it --rm -v $PWD/dist:/dist s6-builder
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Once you have the s6 compiled, copy the tar ball
|
||||
`dist/s6-${s6_version}-musl-static.tar.xz` to your image's repository. Use the
|
||||
`ADD` instruction in Dockerfile to layer s6 binaries onto it, e.g.,
|
||||
```bash
|
||||
ADD s6-1.1.3.2-musl-static.tar /
|
||||
```
|
||||
|
||||
Then you can set you image's entrypoint to s6:
|
||||
```bash
|
||||
ENTRYPOINT ["/usr/bin/s6-svscan","/service"]
|
||||
```
|
||||
Where the `/service` is the *service directory* for s6.
|
||||
@@ -0,0 +1,114 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# This script is a fork from:
|
||||
# https://github.com/jprjr/docker-misc/blob/s6-builder/dockerfiles/arch-s6-builder/build.sh
|
||||
#
|
||||
# Official build instructions are available at:
|
||||
# http://www.skarnet.org/software/s6/install.html
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
musl_version=1.0.4
|
||||
skalibs_version=1.6.0.0
|
||||
execline_version=1.3.1.1
|
||||
s6_version=1.1.3.2
|
||||
|
||||
function build_skarnet_package {
|
||||
echo musl-gcc > conf-compile/conf-cc
|
||||
echo musl-gcc -static > conf-compile/conf-ld
|
||||
echo musl-gcc > conf-compile/conf-dynld
|
||||
echo /usr/bin > conf-compile/conf-install-command
|
||||
rm -f conf-compile/flag-slashpackage
|
||||
touch conf-compile/flag-allstatic
|
||||
package/compile
|
||||
rm -f package/library.so.exported
|
||||
}
|
||||
|
||||
function install_skarnet_package {
|
||||
for i in package/*.exported
|
||||
do
|
||||
case $(basename $i) in
|
||||
library.so.exported) d=/lib ;;
|
||||
include.exported) d=/usr/include/skalibs ;;
|
||||
sysdeps.exported) d=/usr/lib/skalibs/sysdeps;;
|
||||
library.exported) d=/usr/lib/skalibs ;;
|
||||
command.exported) d=/usr/bin ;;
|
||||
esac
|
||||
f=$(basename $i|sed 's/.exported//')
|
||||
mkdir -p $1$d
|
||||
install -D `sed s,^,$f/, $i` "$1$d"
|
||||
done
|
||||
}
|
||||
|
||||
mkdir /package
|
||||
|
||||
mkdir -p /build && cd /build
|
||||
|
||||
# install musl
|
||||
curl -R -L -O http://www.musl-libc.org/releases/musl-${musl_version}.tar.gz
|
||||
tar xf musl-${musl_version}.tar.gz
|
||||
cd musl-${musl_version}
|
||||
|
||||
CFLAGS="-fno-toplevel-reorder -fno-stack-protector" ./configure --prefix=/usr/musl --exec-prefix=/usr --disable-shared
|
||||
make
|
||||
make install
|
||||
|
||||
# install skalibs
|
||||
cd /build
|
||||
curl -R -L -O http://skarnet.org/software/skalibs/skalibs-${skalibs_version}.tar.gz
|
||||
tar xf skalibs-${skalibs_version}.tar.gz
|
||||
cd prog/skalibs-${skalibs_version}
|
||||
|
||||
# configure skalibs-specific items
|
||||
echo /usr/lib/skalibs > conf-compile/conf-install-library
|
||||
echo /usr/include/skalibs > conf-compile/conf-install-include
|
||||
echo /usr/lib/skalibs/sysdeps > conf-compile/conf-install-sysdeps
|
||||
|
||||
build_skarnet_package
|
||||
install_skarnet_package
|
||||
|
||||
install -D -m644 etc/leapsecs.dat /etc/leapsecs.dat
|
||||
|
||||
#install execline
|
||||
cd /build
|
||||
curl -R -L -O http://skarnet.org/software/execline/execline-${execline_version}.tar.gz
|
||||
tar xf execline-${execline_version}.tar.gz
|
||||
cd admin/execline-${execline_version}
|
||||
|
||||
# configure execline-specific items
|
||||
echo /usr/lib/skalibs/sysdeps > conf-compile/import
|
||||
echo /usr/libexec/execline > conf-compile/conf-install-command
|
||||
echo /usr/lib/execline > conf-compile/conf-install-library
|
||||
echo /usr/include/execline > conf-compile/conf-install-include
|
||||
echo /usr/include/skalibs > conf-compile/path-include
|
||||
echo /usr/lib/skalibs > conf-compile/path-library
|
||||
|
||||
build_skarnet_package
|
||||
install_skarnet_package
|
||||
install_skarnet_package /package
|
||||
rm -rf /package/usr/lib
|
||||
rm -rf /package/usr/include
|
||||
XZ_OPT=-9 tar -Jcf /dist/execline-${execline_version}-musl-static.tar -C /package .
|
||||
rm -rf /package/*
|
||||
|
||||
# install s6
|
||||
cd /build
|
||||
curl -R -L -O http://www.skarnet.org/software/s6/s6-${s6_version}.tar.gz
|
||||
tar xf s6-${s6_version}.tar.gz
|
||||
cd admin/s6-${s6_version}
|
||||
|
||||
echo /usr/lib > conf-compile/conf-install-library
|
||||
echo /usr/include > conf-compile/conf-install-include
|
||||
echo /usr/lib/skalibs/sysdeps > conf-compile/import
|
||||
echo /usr/include/skalibs > conf-compile/path-include
|
||||
echo /usr/include/execline >>conf-compile/path-include
|
||||
echo /usr/lib/skalibs > conf-compile/path-library
|
||||
echo /usr/lib/execline >>conf-compile/path-library
|
||||
|
||||
build_skarnet_package
|
||||
install_skarnet_package /package
|
||||
install -D -m644 /etc/leapsecs.dat /package/etc/leapsecs.dat
|
||||
rm -rf /package/usr/lib
|
||||
rm -rf /package/usr/include
|
||||
XZ_OPT=-9 tar -Jcf /dist/s6-${s6_version}-musl-static.tar.xz -C /package .
|
||||
Reference in New Issue
Block a user