diff options
Diffstat (limited to 'arch-nodejs')
| l--------- | arch-nodejs/Dockerfile | 1 | ||||
| -rw-r--r-- | arch-nodejs/Dockerfile.local | 16 | ||||
| -rw-r--r-- | arch-nodejs/Dockerfile.online | 16 | ||||
| -rwxr-xr-x | arch-nodejs/build.sh | 58 |
4 files changed, 91 insertions, 0 deletions
diff --git a/arch-nodejs/Dockerfile b/arch-nodejs/Dockerfile new file mode 120000 index 0000000..bd8469a --- /dev/null +++ b/arch-nodejs/Dockerfile @@ -0,0 +1 @@ +Dockerfile.online
\ No newline at end of file diff --git a/arch-nodejs/Dockerfile.local b/arch-nodejs/Dockerfile.local new file mode 100644 index 0000000..cb401ad --- /dev/null +++ b/arch-nodejs/Dockerfile.local @@ -0,0 +1,16 @@ +FROM sulhan/arch-base:latest +MAINTAINER Sulhan <ms@kilabit.info> + +COPY *.db /var/lib/pacman/sync/ +COPY *.xz /var/cache/pacman/pkg/ + +RUN pacman -S --noconfirm nodejs npm && \ + rm -r /usr/include/* && \ + rm -r /usr/share/doc/nodejs/* && \ + rm -r /usr/share/licenses/* && \ + rm -r /usr/share/man/* && \ + rm -r /usr/lib/node_modules/npm/doc/* && \ + rm -r /usr/lib/node_modules/npm/html/doc/* && \ + rm -r /usr/lib/node_modules/npm/man/* && \ + rm -r /var/cache/pacman/pkg/* && \ + rm -r /var/log/* diff --git a/arch-nodejs/Dockerfile.online b/arch-nodejs/Dockerfile.online new file mode 100644 index 0000000..0b3975d --- /dev/null +++ b/arch-nodejs/Dockerfile.online @@ -0,0 +1,16 @@ +FROM sulhan/arch-base:latest +MAINTAINER Sulhan <ms@kilabit.info> + +RUN echo "nameserver 8.8.8.8" > /etc/resolv.conf +RUN echo "nameserver 172.17.42.1" > /etc/resolv.conf +RUN pacman -Sy +RUN pacman -S --noconfirm --needed nodejs npm && \ + rm -r /usr/include/* && \ + rm -r /usr/share/doc/nodejs/* && \ + rm -r /usr/share/licenses/* && \ + rm -r /usr/share/man/* && \ + rm -r /usr/lib/node_modules/npm/doc/* && \ + rm -r /usr/lib/node_modules/npm/html/doc/* && \ + rm -r /usr/lib/node_modules/npm/man/* && \ + rm -r /var/cache/pacman/pkg/* && \ + rm -r /var/log/* diff --git a/arch-nodejs/build.sh b/arch-nodejs/build.sh new file mode 100755 index 0000000..bd2056d --- /dev/null +++ b/arch-nodejs/build.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +## +## Maintainer: Sulhan <ms@kilabit.info> +## +## Script to build nodejs image using `sulhan/arch-base` as base system. +## +## Usage +## ./build.sh [local|clean] +## +## If no parameter is given, it will sync and install package from container. +## +## local +## update host db and packages first and copy the db and packages to +## container. +## + +clean() { + rm -f *.db + rm -f *.xz + rm -f Dockerfile + ln -s Dockerfile.online Dockerfile + exit $1 +} + +docker_build() { + docker build --force-rm -t sulhan/arch-nodejs:latest . + s=$? + clean $s +} + +if [[ $# = 0 ]]; then + echo "==> Building docker image online ..." + docker_build +fi + +if [[ -z $1 || $1 != local ]]; then + echo "Usage: ./build.sh [online]" + exit 1 +fi + +if [[ $1 = "clean" ]]; then + clean +fi + +echo "==> Building docker image using local db and packages ..." + +## always make sure local db and packages up to date. +sudo pacman -Syu --noconfirm --needed nodejs npm + +cp /var/lib/pacman/sync/*.db ./ +cp /var/cache/pacman/pkg/icu* ./ +cp /var/cache/pacman/pkg/nodejs* ./ +cp /var/cache/pacman/pkg/npm* ./ + +rm -f Dockerfile +ln -s Dockerfile.local Dockerfile +docker_build |
