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 378f81c
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: node

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

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
30 changes: 30 additions & 0 deletions node/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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 \
&& mkdir -p lib/x86_64-linux-gnu usr/local/bin \
\
&& cp -a /usr/local/bin/node usr/local/bin \
&& cp -a /lib/x86_64-linux-gnu/libstdc++.so* lib/x86_64-linux-gnu \
&& cp -a /lib/x86_64-linux-gnu/libgcc_s.so* lib/x86_64-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" ]
23 changes: 23 additions & 0 deletions node/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/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=${version:1}
minor=$(echo ${version} | cut -d. -f2)

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

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

done

0 comments on commit 378f81c

Please sign in to comment.