diff options
-rw-r--r-- | Makefile | 62 | ||||
-rw-r--r-- | bootstrap/Dockerfile | 5 | ||||
-rw-r--r-- | builder/Dockerfile | 15 | ||||
-rw-r--r-- | builder/files/entrypoint.sh | 11 |
4 files changed, 59 insertions, 34 deletions
@@ -1,64 +1,73 @@ +docker := $(shell sh -c '[ -f "/usr/bin/docker" ] && echo "docker" || echo "podman"') +voldir := "/home/docker/volumes" +bindir := "$(voldir)/binpkgs" +distdir := "$(voldir)/distfiles" +confdir := "$(voldir)/darklin" +vols := "-v $(bindir):/var/cache/binpkgs -v $(distdir):/var/cache/distfiles -v $(confdir):/darklin" + + all: build install: push .PHONY: rebuild builder update bash connect start stop restart bash logs debug cancel bootstrap reinit check - - # This is bootstrap image bootstrap: bootstrap/Dockerfile - docker build --tag chsa/gbootstrap:latest bootstrap + $(docker) build --tag chsa/gbootstrap:latest bootstrap reinit: bootstrap/Dockerfile - docker build --no-cache --tag chsa/gbootstrap:latest bootstrap + $(docker) build --no-cache --tag chsa/gbootstrap:latest bootstrap check: bootstrap/Dockerfile - if [ `docker ps -a | grep chsa/gbootstrap | wc -l` -gt 0 ]; then \ - docker rm gbootstrap ;\ + mkdir -p $(bindir) $(distdir) $(confdir);\ + if [ `$(docker) ps -a | grep chsa/gbootstrap | wc -l` -gt 0 ]; then \ + $(docker) rm gbootstrap ;\ fi ;\ - docker run -v /home/docker/volumes/binpkgs:/var/cache/binpkgs --name gbootstrap -it chsa/gbootstrap:latest /bin/bash + eval $(docker) run --privileged $(vols) --name gbootstrap -it chsa/gbootstrap:latest /bin/bash # This is builder itself builder: bootstrap bootstrap/Dockerfile - docker build --tag chsa/gbuilder:latest builder + $(docker) build --tag chsa/gbuilder:latest builder update: builder/Dockerfile - docker build --no-cache --tag chsa/gbuilder:latest builder + $(docker) build --no-cache --tag chsa/gbuilder:latest builder bash: - if [ `docker ps | grep chsa/gbuilder:latest | wc -l` -eq 0 ]; then \ - if [ `docker ps -a | grep gbuilder:latest | wc -l` -gt 0 ]; then \ + mkdir -p $(bindir) ;\ + if [ `$(docker) ps | grep chsa/gbuilder:latest | wc -l` -eq 0 ]; then \ + if [ `$(docker) ps -a | grep gbuilder:latest | wc -l` -gt 0 ]; then \ echo "Stalled copy... Remove to continue..." ;\ - echo "docker rm gbuilder" ;\ + echo "$(docker) rm gbuilder" ;\ exit 1 ;\ fi ;\ - docker run -v /home/docker/volumes/binpkgs:/var/cache/binpkgs --name gbuilder -it chsa/gbuilder:latest /bin/bash ;\ + eval $(docker) run --privileged $(vols) --name gbuilder -it chsa/gbuilder:latest /bin/bash ;\ else \ echo "Already running..." ;\ fi build: - if [ `docker ps | grep chsa/gbuilder:latest | wc -l` -eq 0 ]; then \ - if [ `docker ps -a | grep gbuilder:latest | wc -l` -gt 0 ]; then \ + mkdir -p $(bindir) $(distdir) $(confdir) ;\ + if [ `$(docker) ps | grep chsa/gbuilder:latest | wc -l` -eq 0 ]; then \ + if [ `$(docker) ps -a | grep gbuilder:latest | wc -l` -gt 0 ]; then \ echo "Stalled copy... Remove to continue..." ;\ - echo "docker rm gbuilder" ;\ + echo "$(docker) rm gbuilder" ;\ exit 1 ;\ fi ;\ - docker run -v /home/docker/volumes/binpkgs:/var/cache/binpkgs --name gbuilder -t -d chsa/gbuilder:latest ;\ + eval $(docker) run --privileged $(vols) --name gbuilder -t -d chsa/gbuilder:latest ;\ else \ echo "Already running..." ;\ fi stop: - @if [ `docker ps | grep gbuilder | wc -l` -gt 0 ]; then \ - docker stop gbuilder ;\ + @if [ `$(docker) ps | grep gbuilder | wc -l` -gt 0 ]; then \ + $(docker) stop gbuilder ;\ fi cancel: - @if [ `docker ps -a | grep gbuilder | wc -l` -gt 0 ]; then \ - docker stop gbuilder ;\ - docker rm -f gbuilder ;\ + @if [ `$(docker) ps -a | grep gbuilder | wc -l` -gt 0 ]; then \ + $(docker) stop gbuilder ;\ + $(docker) rm -f gbuilder ;\ fi restart: @@ -67,13 +76,14 @@ restart: # Control logs: - docker logs -f gbuilder + $(docker) logs -f gbuilder connect: - docker exec -it gbuilder /bin/bash + $(docker) exec -it gbuilder /bin/bash # Slow & big, avoid if possible debug: stop echo "Generating image from container. Thats slow!" ; \ - docker commit gbuilder gbuilder-debug ;\ - docker run -v /home/docker/volumes/binpkgs:/var/cache/binpkgs --name gbuilder-debug -ti bash + $(docker) commit gbuilder gbuilder-debug ;\ + mkdir -p $(bindir) $(distdir) $(confdir) ;\ + eval $(docker) run --privileged $(vols) --name gbuilder-debug -ti bash diff --git a/bootstrap/Dockerfile b/bootstrap/Dockerfile index 08d0447..afc13d1 100644 --- a/bootstrap/Dockerfile +++ b/bootstrap/Dockerfile @@ -11,8 +11,7 @@ RUN emerge --sync && \ # echo 'PYTHON_SINGLE_TARGET="python3_6"' >> /etc/portage/make.conf # Install mandatory packages -RUN emerge -1 -U =gcc-8.3.0* distcc dev-vcs/git dev-vcs/bzr app-portage/layman app-portage/gentoolkit app-portage/eix app-misc/mc dev-libs/libxml2 && \ - eix-sync +RUN emerge -1 -U =gcc-8.3.0* distcc dev-vcs/git dev-vcs/bzr app-portage/layman app-portage/gentoolkit app-portage/eix app-misc/mc dev-libs/libxml2 net-ftp/lftp # Adapt configuration RUN \ @@ -38,6 +37,8 @@ RUN \ echo "local" > /usr/local/portage/profiles/repo_name && \ bash /etc/portage/scripts/bootstrap/layman_reinit.sh && \ \ + # Skip binary packages + rm -f /etc/portage/sets/desktop-apps-bin && \ # Adjusting for legacy packets rm -f /etc/portage/sets/legacy && \ rm -f /etc/portage/package.keywords/skip.keywords && \ diff --git a/builder/Dockerfile b/builder/Dockerfile index 898cfd3..7e257b7 100644 --- a/builder/Dockerfile +++ b/builder/Dockerfile @@ -1,9 +1,12 @@ FROM chsa/gbootstrap -RUN \ - cd /darklin/gentoo && git pull && \ - cd /darklin/darklin4 && git pull && \ - emerge --sync && eix-sync && \ - emerge -1 portage +# We do it now inside (git pull also may bring back un-necessary and potentialy problematic configs) +#RUN \ +# cd /darklin/gentoo && git pull && \ +# cd /darklin/darklin4 && git pull && \ +# emerge --sync && eix-sync && \ +# emerge -1 portage + +COPY files/ / -CMD ["/bin/bash", "/etc/portage/scripts/bootstrap/builder.sh"] +CMD ["/bin/bash", "/entrypoint.sh"] diff --git a/builder/files/entrypoint.sh b/builder/files/entrypoint.sh new file mode 100644 index 0000000..6685207 --- /dev/null +++ b/builder/files/entrypoint.sh @@ -0,0 +1,11 @@ +#! /bin/bash + +if [ ! -d "/darklin/gentoo" ]; then + cd "/darklin" && git clone http://darksoft.org/git/csa/devops/darkconf/gentoo.git || exit 1 +fi + +if [ ! -d "/darklin/darklin4" ]; then + cd "/darklin" && git clone http://darksoft.org/git/csa/devops/darkconf/darklin4.git || exit 1 +fi + +/bin/bash "/etc/portage/scripts/bootstrap/builder.sh" |