Skip to content

Commit

Permalink
feat: introduced node build.
Browse files Browse the repository at this point in the history
  • Loading branch information
akornatskyy committed Dec 13, 2023
1 parent 681a9dc commit 0c14ab4
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: node

on:
schedule:
- cron: "15 3 * * 6" # At 03:15 on Saturday.
push:
branches:
- master
paths:
- node/*

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: akorn
password: ${{ secrets.docker_password }}
- run: sh ./node/update.sh
36 changes: 36 additions & 0 deletions node/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
ARG NODE_VERSION

FROM node:${NODE_VERSION}-bookworm-slim as b

RUN set -ex \
\
&& apt-get -yq update \
&& apt-get -yq upgrade \
\
&& apt-get -yq install binutils \
\
&& strip -sXx /usr/local/bin/node \
\
&& mkdir -p /opt/rootfs \
&& cd /opt/rootfs \
\
&& ARCH=$(dpkg --print-architecture) \
&& case "${ARCH}" in \
amd64) ARCH='x86_64' ;; \
arm64) ARCH='aarch64' ;; \
esac \
&& mkdir -p lib/${ARCH}-linux-gnu usr/local/bin \
\
&& cp -a /usr/local/bin/node usr/local/bin \
&& cp -a /lib/${ARCH}-linux-gnu/libstdc++.so* lib/${ARCH}-linux-gnu \
&& cp -a /lib/${ARCH}-linux-gnu/libgcc_s.so* lib/${ARCH}-linux-gnu

FROM gcr.io/distroless/base-debian12

ARG NODE_VERSION
LABEL nodejs/version=${NODE_VERSION}

COPY --from=b /opt/rootfs /

CMD []
ENTRYPOINT [ "/usr/local/bin/node" ]
24 changes: 24 additions & 0 deletions node/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh
set -e


cd "$(dirname "$(readlink -f "$0")")"
for major in 20 21 ; do
version=$(docker run --rm node:${major}-bookworm-slim --version)
version=$(echo ${version} | cut -c2-)
minor=$(echo ${version} | cut -d. -f2)

image=akorn/node
echo building ${version} ...

docker buildx build \
--build-arg NODE_VERSION=${version} \
--tag ${image} \
--tag ${image}:${major} \
--tag ${image}:${major}.${minor} \
--tag ${image}:${version} \
--platform linux/amd64,linux/arm64 \
--push \
.

done

0 comments on commit 0c14ab4

Please sign in to comment.