-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #676 from ober/add-multi-distro-docker-support
Add multi distro docker support
- Loading branch information
Showing
5 changed files
with
260 additions
and
97 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,99 @@ | ||
ARG distro | ||
ARG gerbil_version | ||
ARG gambit_version | ||
ARG cores | ||
ARG packages | ||
|
||
FROM ${distro}:latest as base | ||
ARG distro | ||
ARG gerbil_version | ||
ARG gambit_version | ||
ARG cores | ||
ARG packages | ||
ENV GERBIL_BUILD_CORES=$cores | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN mkdir -p /src /opt | ||
RUN case ${distro} in \ | ||
alpine) \ | ||
apk update && \ | ||
eval apk add ${packages} && \ | ||
cd /src && git clone --recurse-submodules https://github.com/google/leveldb.git && cd /src/leveldb && mkdir -p build && cd build && cmake -DCMAKE_BUILD_TYPE=Release .. && cmake --build . && mv libleveldb.a /usr/lib && \ | ||
cd /src && git clone https://github.com/LMDB/lmdb && cd /src/lmdb/libraries/liblmdb && make && cd /src/lmdb/libraries/liblmdb && mv liblmdb.a /usr/lib \ | ||
;; \ | ||
amazonlinux|fedora) \ | ||
yum update -y && yum groupinstall -y 'Development Tools' && \ | ||
eval yum install -y ${packages} \ | ||
;; \ | ||
ubuntu) \ | ||
apt update -y && \ | ||
eval apt install -y ${packages} \ | ||
;; \ | ||
*) \ | ||
echo "Unknown distro ${distro}" \ | ||
exit 2\ | ||
;; \ | ||
esac | ||
|
||
FROM base as gambit | ||
ARG cores | ||
ARG distro | ||
ARG gerbil_version | ||
ARG gambit_version | ||
ARG cores | ||
ENV GAMBIT_HOME=/opt/gambit | ||
ENV GERBIL_BUILD_CORES=$cores | ||
ENV GERBIL_HOME=/opt/gerbil | ||
ENV GERBIL_PATH=/src/.gerbil | ||
ENV PATH=${GAMBIT_HOME}/bin:${GERBIL_HOME}/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin | ||
RUN git config --global url.https://github.com/.insteadOf git://github.com/ | ||
RUN cd /opt && git clone https://github.com/gambit/gambit gambit-src | ||
RUN cd /opt/gambit-src && git fetch -a && git checkout ${gambit_version} | ||
RUN cd /opt/gambit-src \ | ||
&& ./configure CC='gcc' \ | ||
--enable-default-runtime-options=f8,-8,t8 \ | ||
--enable-poll \ | ||
--enable-openssl \ | ||
--enable-multiple-versions \ | ||
--enable-single-host \ | ||
--prefix=${GAMBIT_HOME} | ||
|
||
RUN cd /opt/gambit-src && make -j$cores | ||
RUN cd /opt/gambit-src && make bootstrap | ||
RUN cd /opt/gambit-src && make bootclean | ||
RUN cd /opt/gambit-src && make -j$cores | ||
RUN cd /opt/gambit-src && make -j$cores modules | ||
RUN cd /opt/gambit-src && make install | ||
|
||
FROM gambit as gerbil | ||
ARG cores | ||
ARG gerbil_version | ||
RUN if [[ ! -d /usr/lib64/mariadb && -d /usr/lib64/mysql ]]; then ln -s /usr/lib64/mysql /usr/lib64/mariadb; fi | ||
RUN cd /opt && git clone https://github.com/vyzo/gerbil gerbil-src | ||
ENV PATH=/opt/gambit/current/bin:$PATH | ||
RUN cd /opt/gerbil-src/src && git fetch -a && git fetch --tags && git checkout ${gerbil_version} \ | ||
&& ./configure \ | ||
--prefix=${GERBIL_HOME} \ | ||
--enable-leveldb \ | ||
--enable-libxml \ | ||
--enable-libyaml \ | ||
--enable-lmdb \ | ||
--enable-mysql | ||
|
||
RUN cd /opt/gerbil-src/src && ./build.sh sanity-check | ||
RUN cd /opt/gerbil-src/src && ./build.sh gxi | ||
RUN cd /opt/gerbil-src/src && ./build.sh stage0 | ||
RUN cd /opt/gerbil-src/src && ./build.sh stage1 final | ||
RUN cd /opt/gerbil-src/src && ./build.sh stdlib | ||
RUN cd /opt/gerbil-src/src && ./build.sh lang | ||
RUN cd /opt/gerbil-src/src && ./build.sh r7rs-large | ||
RUN cd /opt/gerbil-src/src && ./build.sh tools | ||
RUN cd /opt/gerbil-src/src && ./build.sh tags | ||
RUN cd /opt/gerbil-src/src && ./build.sh layout | ||
RUN cd /opt/gerbil-src/src && ./build.sh doc | ||
RUN cd /opt/gerbil-src/src && ./install | ||
|
||
FROM gerbil as final | ||
RUN rm -rf /opt/gerbil-src /opt/gambit-src | ||
|
||
WORKDIR /src | ||
CMD ["gxi"] |
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,161 @@ | ||
.PHONY: alpine amazonlinux ubuntu fedora ubuntu-current-jedi final | ||
|
||
GERBIL_VERSION := v0.17 | ||
GAMBIT_VERSION := v4.9.4 | ||
|
||
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) | ||
cores := $(shell grep -c "^processor" /proc/cpuinfo) | ||
|
||
#$(eval squid_ip := $(shell docker inspect squid|jq -r '.[].NetworkSettings.IPAddress')) | ||
#$(info $(cores) is cores) | ||
|
||
alpine_packages := autoconf \ | ||
automake \ | ||
cmake \ | ||
curl \ | ||
g++ \ | ||
gcc \ | ||
git \ | ||
leveldb-dev \ | ||
libgcc \ | ||
libtool \ | ||
libxml2-dev \ | ||
linux-headers \ | ||
lmdb-dev \ | ||
make \ | ||
mariadb-dev \ | ||
musl \ | ||
musl-dev \ | ||
nodejs \ | ||
openssl-dev \ | ||
openssl-libs-static \ | ||
ruby \ | ||
sqlite-dev \ | ||
yaml-dev \ | ||
yaml-static \ | ||
zlib-static | ||
|
||
amazon_packages := cmake \ | ||
leveldb-devel \ | ||
libsqlite3x-devel \ | ||
libxml2-devel \ | ||
libyaml-devel \ | ||
lmdb-devel \ | ||
mariadb-devel \ | ||
mariadb-libs \ | ||
openssl-devel \ | ||
sqlite-devel | ||
|
||
fedora_packages := cmake \ | ||
leveldb-devel \ | ||
libsqlite3x-devel \ | ||
libxml2-devel \ | ||
libyaml-devel \ | ||
lmdb-devel \ | ||
mariadb-devel \ | ||
openssl-devel \ | ||
sqlite-devel | ||
|
||
ubuntu_packages := autoconf \ | ||
bison \ | ||
build-essential \ | ||
curl \ | ||
gawk \ | ||
git \ | ||
libleveldb-dev \ | ||
libleveldb1d \ | ||
liblmdb-dev \ | ||
libmysqlclient-dev \ | ||
libnss3-dev \ | ||
libsnappy1v5 \ | ||
libsqlite3-dev \ | ||
libssl-dev \ | ||
libxml2-dev \ | ||
libyaml-dev \ | ||
pkg-config \ | ||
python3 \ | ||
rsync \ | ||
rubygems \ | ||
texinfo \ | ||
zlib1g-dev | ||
|
||
alpine: | ||
docker build --target final \ | ||
--rm=true --no-cache \ | ||
--build-arg gambit_version=$(GAMBIT_VERSION) \ | ||
--build-arg gerbil_version=$(GERBIL_VERSION) \ | ||
--build-arg packages="$(alpine_packages)" \ | ||
--build-arg cores=$(cores) \ | ||
--build-arg distro="alpine" -t final $(ROOT_DIR) | ||
docker tag final gerbil/alpine | ||
|
||
amazonlinux: | ||
docker build --target final \ | ||
--build-arg gambit_version=$(GAMBIT_VERSION) \ | ||
--build-arg gerbil_version=$(GERBIL_VERSION) \ | ||
--build-arg packages="$(amazon_packages)" \ | ||
--build-arg cores=$(cores) \ | ||
--build-arg distro="amazonlinux" \ | ||
-t final $(ROOT_DIR) | ||
docker tag final gerbil/amazonlinux | ||
|
||
centos: | ||
docker build --target final \ | ||
--rm=true --no-cache \ | ||
--build-arg gambit_version=$(GAMBIT_VERSION) \ | ||
--build-arg gerbil_version=$(GERBIL_VERSION) \ | ||
--build-arg packages="$(centos_packages)" \ | ||
--build-arg cores=$(cores) \ | ||
--build-arg distro="centos" \ | ||
-t final $(ROOT_DIR) | ||
docker tag final gerbil/centos | ||
|
||
fedora: | ||
docker build --target final \ | ||
--build-arg gambit_version=$(GAMBIT_VERSION) \ | ||
--build-arg gerbil_version=$(GERBIL_VERSION) \ | ||
--build-arg packages="$(fedora_packages)" \ | ||
--build-arg cores=$(cores) \ | ||
--build-arg distro="fedora" \ | ||
-t final $(ROOT_DIR) | ||
docker tag final gerbil/fedora | ||
|
||
ubuntu: | ||
docker build --target final \ | ||
--rm=true --no-cache \ | ||
--build-arg gambit_version=$(GAMBIT_VERSION) \ | ||
--build-arg gerbil_version=$(GERBIL_VERSION) \ | ||
--build-arg packages="$(ubuntu_packages)" \ | ||
--build-arg cores=$(cores) \ | ||
--build-arg distro="ubuntu" \ | ||
-t final $(ROOT_DIR) | ||
docker tag final gerbil/ubuntu | ||
|
||
ubuntu-current-jedi: | ||
docker build --rm=true --no-cache -t ubuntu-current-jedi $(ROOT_DIR)/ubuntu-current-jedi | ||
docker tag ubuntu-current-jedi gerbil/jedi:ubuntu | ||
|
||
package-ubuntu: | ||
docker run -v $(PWD):/src -t gerbil/ubuntu \ | ||
bash -c "gem install fpm && \ | ||
fpm -s dir -p /src/ -t deb -n gerbil-$(gerbil_version)-gambit-$(gambit_version).ubuntu \ | ||
--description 'Gambit and Gerbil Package' /opt/gerbil /opt/gambit" | ||
|
||
package-fedora: | ||
docker run -v $(PWD):/src -t gerbil/fedora \ | ||
bash -c "yum install -y rubygems ruby-devel rpm-build && \ | ||
gem install fpm && \ | ||
fpm -s dir -p /src/ -t rpm \ | ||
-n gerbil-$(gerbil_version)-gambit-$(gambit_version).fedora \ | ||
--description 'Gambit and Gerbil Package' /opt/gerbil /opt/gambit" | ||
|
||
packages: package-ubuntu package-fedora | ||
|
||
push-all: all | ||
docker push gerbil/alpine | ||
docker push gerbil/ubuntu | ||
docker push gerbil/fedora | ||
|
||
all: alpine amazonlinux fedora ubuntu | ||
|
||
docker: ubuntu |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.