Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add node 10.24.1-debian #108

Merged
merged 5 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions generate.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -o nounset

ORGANIZATION=$1
REPOSITORY=$2
Expand Down
42 changes: 42 additions & 0 deletions library/node/10.24.1-debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM cr.loongnix.cn/library/buildpack-deps:buster

RUN groupadd --gid 1000 node \
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node

ENV NODE_VERSION 10.24.1

RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
&& case "${dpkgArch##*-}" in \
amd64) ARCH='x64';; \
ppc64el) ARCH='ppc64le';; \
s390x) ARCH='s390x';; \
arm64) ARCH='arm64';; \
armhf) ARCH='armv7l';; \
i386) ARCH='x86';; \
loongarch64) ARCH='loong64';; \
*) echo "unsupported architecture"; exit 1 ;; \
esac \
&& curl -fsSLO --compressed "http://ftp.loongnix.cn/nodejs/LoongArch/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \
&& tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \
&& rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs \
# smoke tests
&& node --version \
&& npm --version

ENV YARN_VERSION 1.22.5

RUN set -ex \
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
&& mkdir -p /opt \
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/ \
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \
&& rm yarn-v$YARN_VERSION.tar.gz \
# smoke test
&& yarn --version

COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]

CMD [ "node" ]
28 changes: 28 additions & 0 deletions library/node/10.24.1-debian/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This file is generated by the template.

REGISTRY?=cr.loongnix.cn
ORGANIZATION?=library
REPOSITORY?=node
TAG?=10.24.1-debian
LATEST?=true

IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG)
LATEST_IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):latest

default: image

image:
docker build \
--build-arg http_proxy=$(http_proxy) \
--build-arg https_proxy=$(https_proxy) \
-t $(IMAGE) \
.

push:
docker push $(IMAGE)
#latest image
@if [ $(LATEST) = "true" ]; \
then \
docker tag $(IMAGE) $(LATEST_IMAGE); \
docker push $(LATEST_IMAGE); \
fi
8 changes: 8 additions & 0 deletions library/node/10.24.1-debian/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -e

if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ]; then
set -- node "$@"
fi

exec "$@"
44 changes: 44 additions & 0 deletions library/node/12.19.1-debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
FROM cr.loongnix.cn/library/buildpack-deps:buster

RUN groupadd --gid 1000 node \
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node

ENV NODE_VERSION 12.19.1

RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
&& case "${dpkgArch##*-}" in \
amd64) ARCH='x64';; \
ppc64el) ARCH='ppc64le';; \
s390x) ARCH='s390x';; \
arm64) ARCH='arm64';; \
armhf) ARCH='armv7l';; \
i386) ARCH='x86';; \
loongarch64) ARCH='loong64';; \
*) echo "unsupported architecture"; exit 1 ;; \
esac \
# gpg keys listed at https://github.com/nodejs/node#release-keys
&& set -ex \
&& curl -fsSLO --compressed "http://ftp.loongnix.cn/nodejs/LoongArch/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \
&& tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \
&& rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs \
# smoke tests
&& node --version \
&& npm --version

ENV YARN_VERSION 1.22.5

RUN set -ex \
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
&& mkdir -p /opt \
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/ \
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \
&& rm yarn-v$YARN_VERSION.tar.gz \
# smoke test
&& yarn --version

COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]

CMD [ "node" ]
28 changes: 28 additions & 0 deletions library/node/12.19.1-debian/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This file is generated by the template.

REGISTRY?=cr.loongnix.cn
ORGANIZATION?=library
REPOSITORY?=node
TAG?=12.19.1-debian
LATEST?=true

IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG)
LATEST_IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):latest

default: image

image:
docker build \
--build-arg http_proxy=$(http_proxy) \
--build-arg https_proxy=$(https_proxy) \
-t $(IMAGE) \
.

push:
docker push $(IMAGE)
#latest image
@if [ $(LATEST) = "true" ]; \
then \
docker tag $(IMAGE) $(LATEST_IMAGE); \
docker push $(LATEST_IMAGE); \
fi
8 changes: 8 additions & 0 deletions library/node/12.19.1-debian/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -e

if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ]; then
set -- node "$@"
fi

exec "$@"
46 changes: 46 additions & 0 deletions library/node/14.16.1-debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM cr.loongnix.cn/library/buildpack-deps:buster

LABEL maintainer znley<[email protected]>

RUN groupadd --gid 1000 node \
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node

ENV NODE_VERSION 14.16.1

RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
&& case "${dpkgArch##*-}" in \
amd64) ARCH='x64';; \
ppc64el) ARCH='ppc64le';; \
s390x) ARCH='s390x';; \
arm64) ARCH='arm64';; \
armhf) ARCH='armv7l';; \
i386) ARCH='x86';; \
loongarch64) ARCH='loong64';; \
*) echo "unsupported architecture"; exit 1 ;; \
esac \
# gpg keys listed at https://github.com/nodejs/node#release-keys
&& set -ex \
&& curl -fsSLO --compressed "http://ftp.loongnix.cn/nodejs/LoongArch/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \
&& tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \
&& rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs \
# smoke tests
&& node --version \
&& npm --version

ENV YARN_VERSION 1.22.5

RUN set -ex \
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
&& mkdir -p /opt \
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/ \
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg \
&& rm yarn-v$YARN_VERSION.tar.gz \
# smoke test
&& yarn --version

COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]

CMD [ "node" ]
28 changes: 28 additions & 0 deletions library/node/14.16.1-debian/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This file is generated by the template.

REGISTRY?=cr.loongnix.cn
ORGANIZATION?=library
REPOSITORY?=node
TAG?=14.16.1-debian
LATEST?=true

IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG)
LATEST_IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):latest

default: image

image:
docker build \
--build-arg http_proxy=$(http_proxy) \
--build-arg https_proxy=$(https_proxy) \
-t $(IMAGE) \
.

push:
docker push $(IMAGE)
#latest image
@if [ $(LATEST) = "true" ]; \
then \
docker tag $(IMAGE) $(LATEST_IMAGE); \
docker push $(LATEST_IMAGE); \
fi
8 changes: 8 additions & 0 deletions library/node/14.16.1-debian/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -e

if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ]; then
set -- node "$@"
fi

exec "$@"
1 change: 1 addition & 0 deletions loongson/loongnix/20/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
rootfs.tar.gz
rootfs.tar.xz
4 changes: 2 additions & 2 deletions loongson/loongnix/20/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ TAG?=20
IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG)
ALIAS=cr.loongnix.cn/library/debian:buster

ROOTFS=rootfs.tar.gz
ROOTFS=rootfs.tar.xz

default: image

Expand All @@ -27,4 +27,4 @@ $(ROOTFS):
docker run --rm \
-v `pwd`:/work \
cr.loongnix.cn/library/debian:buster \
/bin/bash -c "/work/make_rootfs.sh /work"
/bin/bash -c "/work/make_rootfs.sh"
47 changes: 42 additions & 5 deletions loongson/loongnix/20/make_rootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ set -ex

: ${MIRROR_ADDRESS:="http://pkg.loongnix.cn/loongnix"}
: ${RELEASE:="DaoXiangHu-stable"}
: ${ROOTFS:="rootfs.tar.gz"}
: ${ROOTFS:="rootfs.tar.xz"}
: ${APT_CONF_URL:="https://raw.githubusercontent.com/GoogleContainerTools/base-images-docker/master/debian/reproducible/overlay/etc/apt/apt.conf.d/"}

DISTRO=loongnix

WKDIR=$1
cd ${WKDIR?}
OUTPUT=$(cd $(dirname $0); pwd)
cd ${OUTPUT?}

apt update
apt install -y debootstrap
apt install -y curl debootstrap xz-utils
# loongnix do not have $RELEASE file, fix it!
if [ ! -f /usr/share/debootstrap/scripts/$RELEASE ]; then
ln -s /usr/share/debootstrap/scripts/sid /usr/share/debootstrap/scripts/$RELEASE
Expand All @@ -24,5 +26,40 @@ TMPDIR=`mktemp -d`
debootstrap --no-check-gpg --variant=minbase --components=main,non-free,contrib --arch=loongarch64 --foreign $RELEASE $TMPDIR $MIRROR_ADDRESS
chroot $TMPDIR debootstrap/debootstrap --second-stage
chroot $TMPDIR rm -rf /tmp/* /var/cache/apt/* /var/lib/apt/lists/*

# https://github.com/GoogleContainerTools/base-images-docker/tree/master/debian/reproducible/overlay/etc/apt/apt.conf.d
apt_conf=(
apt-retry
docker-autoremove-suggests
docker-clean
docker-gzip-indexes
)

for apt_file in ${apt_conf[@]};do
curl -o $TMPDIR/etc/apt/apt.conf.d/${apt_file} -sSL ${APT_CONF_URL}/${apt_file}
done

pkgExcludes='loongnix-gpu-driver-service,loonggpu-compiler,loonggl-dev'
pkgIncludes='libncursesw6,libseccomp2,sysvinit-utils'
chroot $TMPDIR bash -c '
apt-get -o apt-get -o Acquire::Check-Valid-Until=false update -qq
if apt-mark --help &> /dev/null; then
apt-mark auto ".*" > /dev/null
fi
if [ -n "$1" ]; then
IFS=","; includePackages=( $1 ); unset IFS
apt-get install -y --no-install-recommends "${includePackages[@]}"
fi
if [ -n "$2" ]; then
IFS=","; excludePackages=( $2 ); unset IFS
apt-get autoremove -y --purge --allow-remove-essential "${excludePackages[@]}"
fi
for user in systemd-timesync systemd-network systemd-resolve; do
if id $user >/dev/null; then
userdel --force --remove $user
fi
done
' -- $pkgIncludes $pkgExcludes

# package rootfs.tar.gz
tar -zcvf $ROOTFS -C $TMPDIR .
tar -cJvf $ROOTFS -C $TMPDIR .