Skip to content

Commit a321560

Browse files
committed
feat: nodejs
1 parent 523ee19 commit a321560

File tree

6 files changed

+124
-49
lines changed

6 files changed

+124
-49
lines changed

.github/workflows/alpine.yml

+14-11
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,12 @@ jobs:
109109
uses: docker/metadata-action@v5.6.1
110110
with:
111111
images: |
112-
name=snowdreamtech/base,enable=true
113-
name=ghcr.io/snowdreamtech/base,enable=true
114-
name=quay.io/snowdreamtech/base,enable=true
112+
name=snowdreamtech/node,enable=true
113+
name=snowdreamtech/nodejs,enable=true
114+
name=ghcr.io/snowdreamtech/node,enable=true
115+
name=ghcr.io/snowdreamtech/nodejs,enable=true
116+
name=quay.io/snowdreamtech/node,enable=true
117+
name=quay.io/snowdreamtech/nodejs,enable=true
115118
flavor: |
116119
latest=false
117120
prefix=
@@ -133,14 +136,14 @@ jobs:
133136
type=match,enable=true,priority=800,prefix=,suffix=-alpine,pattern=\d+.\d+.\d+,group=0,value=
134137
type=match,enable=true,priority=800,prefix=,suffix=-alpine,pattern=\d+.\d+,group=0,value=
135138
type=match,enable=${{ !startsWith(github.ref, 'refs/tags/0.') && !startsWith(github.ref, 'refs/tags/v0.') && !startsWith(github.ref, 'refs/tags/V0.') && !startsWith(github.ref, 'refs/tags/alpine-0.') && !startsWith(github.ref, 'refs/tags/alpine-v0.') && !startsWith(github.ref, 'refs/tags/alpine-V0.') }},priority=800,prefix=,suffix=-alpine,pattern=\d+,group=0,value=
136-
type=ref,enable=${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/master' && github.event_name != 'schedule' }},priority=600,prefix=,suffix=-alpine3.20,event=branch
137-
type=edge,enable=true,priority=700,prefix=,suffix=-alpine3.20,branch=dev
138-
type=raw,enable=${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') && github.event_name != 'schedule' }},priority=200,prefix=,suffix=,value=alpine3.20
139-
type=raw,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=200,prefix=,suffix=,value=alpine3.20
140-
type=schedule,enable=true,priority=1000,prefix=,suffix=-alpine3.20,pattern=nightly
141-
type=match,enable=true,priority=800,prefix=,suffix=-alpine3.20,pattern=\d+.\d+.\d+,group=0,value=
142-
type=match,enable=true,priority=800,prefix=,suffix=-alpine3.20,pattern=\d+.\d+,group=0,value=
143-
type=match,enable=${{ !startsWith(github.ref, 'refs/tags/0.') && !startsWith(github.ref, 'refs/tags/v0.') && !startsWith(github.ref, 'refs/tags/V0.') && !startsWith(github.ref, 'refs/tags/alpine-0.') && !startsWith(github.ref, 'refs/tags/alpine-v0.') && !startsWith(github.ref, 'refs/tags/alpine-V0.') }},priority=800,prefix=,suffix=-alpine3.20,pattern=\d+,group=0,value=
139+
type=ref,enable=${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/master' && github.event_name != 'schedule' }},priority=600,prefix=,suffix=-alpine3.21,event=branch
140+
type=edge,enable=true,priority=700,prefix=,suffix=-alpine3.21,branch=dev
141+
type=raw,enable=${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') && github.event_name != 'schedule' }},priority=200,prefix=,suffix=,value=alpine3.21
142+
type=raw,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=200,prefix=,suffix=,value=alpine3.21
143+
type=schedule,enable=true,priority=1000,prefix=,suffix=-alpine3.21,pattern=nightly
144+
type=match,enable=true,priority=800,prefix=,suffix=-alpine3.21,pattern=\d+.\d+.\d+,group=0,value=
145+
type=match,enable=true,priority=800,prefix=,suffix=-alpine3.21,pattern=\d+.\d+,group=0,value=
146+
type=match,enable=${{ !startsWith(github.ref, 'refs/tags/0.') && !startsWith(github.ref, 'refs/tags/v0.') && !startsWith(github.ref, 'refs/tags/V0.') && !startsWith(github.ref, 'refs/tags/alpine-0.') && !startsWith(github.ref, 'refs/tags/alpine-v0.') && !startsWith(github.ref, 'refs/tags/alpine-V0.') }},priority=800,prefix=,suffix=-alpine3.21,pattern=\d+,group=0,value=
144147
env:
145148
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
146149
- name: Build and push

.github/workflows/debian.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,12 @@ jobs:
109109
uses: docker/metadata-action@v5.6.1
110110
with:
111111
images: |
112-
name=snowdreamtech/base,enable=true
113-
name=ghcr.io/snowdreamtech/base,enable=true
114-
name=quay.io/snowdreamtech/base,enable=true
112+
name=snowdreamtech/node,enable=true
113+
name=snowdreamtech/nodejs,enable=true
114+
name=ghcr.io/snowdreamtech/node,enable=true
115+
name=ghcr.io/snowdreamtech/nodejs,enable=true
116+
name=quay.io/snowdreamtech/node,enable=true
117+
name=quay.io/snowdreamtech/nodejs,enable=true
115118
flavor: |
116119
latest=false
117120
prefix=

.github/workflows/description.yml

+20-2
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,33 @@ jobs:
2323
DOCKER_USER: ${{ secrets.DOCKER_HUB_USERNAME }}
2424
DOCKER_PASS: ${{ secrets.DOCKER_HUB_TOKEN }}
2525
with:
26-
destination_container_repo: snowdreamtech/base
26+
destination_container_repo: snowdreamtech/node
2727
provider: dockerhub
2828
short_description: ${{ github.event.repository.description }}
2929
readme_file: "README.md"
30+
- name: Docker Hub Description
31+
uses: christian-korneck/update-container-description-action@v1
32+
env:
33+
DOCKER_USER: ${{ secrets.DOCKER_HUB_USERNAME }}
34+
DOCKER_PASS: ${{ secrets.DOCKER_HUB_TOKEN }}
35+
with:
36+
destination_container_repo: snowdreamtech/nodejs
37+
provider: dockerhub
38+
short_description: ${{ github.event.repository.description }}
39+
readme_file: "README.md"
40+
- name: Quay.io Description
41+
uses: christian-korneck/update-container-description-action@v1
42+
env:
43+
DOCKER_APIKEY: ${{ secrets.QUAY_API_TOKEN }}
44+
with:
45+
destination_container_repo: quay.io/snowdreamtech/node
46+
provider: quay
47+
readme_file: "README.md"
3048
- name: Quay.io Description
3149
uses: christian-korneck/update-container-description-action@v1
3250
env:
3351
DOCKER_APIKEY: ${{ secrets.QUAY_API_TOKEN }}
3452
with:
35-
destination_container_repo: quay.io/snowdreamtech/base
53+
destination_container_repo: quay.io/snowdreamtech/nodejs
3654
provider: quay
3755
readme_file: "README.md"

README.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Base
1+
# Node
22

3-
[![Base](http://dockeri.co/image/snowdreamtech/base)](https://hub.docker.com/r/snowdreamtech/base)
3+
[![Node](http://dockeri.co/image/snowdreamtech/node)](https://hub.docker.com/r/snowdreamtech/node)
44

5-
Docker Image packaging for Base. (amd64, arm32v5, arm32v6, arm32v7, arm64v8, i386, mips64le, ppc64le,riscv64, s390x)
5+
Docker Image packaging for Node. (amd64, arm32v5, arm32v6, arm32v7, arm64v8, i386, mips64le, ppc64le,riscv64, s390x)
66

77
# Usage
88

@@ -14,21 +14,21 @@ To help you get started creating a container from this image you can either use
1414

1515
```bash
1616
docker run -d \
17-
--name=base \
17+
--name=node \
1818
-e TZ=Asia/Shanghai \
1919
--restart unless-stopped \
20-
snowdreamtech/base:latest
20+
snowdreamtech/node:latest
2121
```
2222

2323
### Advance
2424

2525
```bash
2626
docker run -d \
27-
--name=base \
27+
--name=node \
2828
-e TZ=Asia/Shanghai \
2929
-v /path/to/data:/path/to/data \
3030
--restart unless-stopped \
31-
snowdreamtech/base:latest
31+
snowdreamtech/node:latest
3232
```
3333

3434
## Docker Compose
@@ -37,9 +37,9 @@ docker run -d \
3737

3838
```bash
3939
services:
40-
base:
41-
image: snowdreamtech/base:latest
42-
container_name: base
40+
node:
41+
image: snowdreamtech/node:latest
42+
container_name: node
4343
environment:
4444
- TZ=Asia/Shanghai
4545
restart: unless-stopped
@@ -49,9 +49,9 @@ services:
4949

5050
```bash
5151
services:
52-
base:
53-
image: snowdreamtech/base:latest
54-
container_name: base
52+
node:
53+
image: snowdreamtech/node:latest
54+
container_name: node
5555
environment:
5656
- TZ=Asia/Shanghai
5757
volumes:
@@ -63,7 +63,7 @@ services:
6363

6464
```bash
6565
docker buildx create --use --name build --node build --driver-opt network=host
66-
docker buildx build -t snowdreamtech/base --platform=linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/riscv64,linux/s390x . --push
66+
docker buildx build -t snowdreamtech/node --platform=linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/riscv64,linux/s390x . --push
6767
```
6868

6969
## Reference
@@ -75,7 +75,7 @@ docker buildx build -t snowdreamtech/base --platform=linux/386,linux/amd64,linux
7575
1. [Faster Multi-Platform Builds: Dockerfile Cross-Compilation Guide](https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/)
7676
1. [docker/buildx](https://github.com/docker/buildx)
7777

78-
## Contact (备注:base)
78+
## Contact (备注:node)
7979

8080
* Email: sn0wdr1am@qq.com
8181
* QQ: 3217680847

alpine/Dockerfile

+32-10
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,44 @@
1-
FROM snowdreamtech/alpine:3.20.3
1+
FROM snowdreamtech/alpine:3.21.0
22

33
# OCI annotations to image
44
LABEL org.opencontainers.image.authors="Snowdream Tech" \
5-
org.opencontainers.image.title="Base Image Based On Alpine" \
6-
org.opencontainers.image.description="Docker Images for Base on Alpine. (i386, amd64, arm32v6, arm32v7, arm64, ppc64le,riscv64, s390x)" \
7-
org.opencontainers.image.documentation="https://hub.docker.com/r/snowdreamtech/base" \
8-
org.opencontainers.image.base.name="snowdreamtech/base:alpine" \
5+
org.opencontainers.image.title="Node Image Noded On Alpine" \
6+
org.opencontainers.image.description="Docker Images for Node on Alpine. (i386, amd64, arm32v6, arm32v7, arm64, ppc64le,riscv64, s390x)" \
7+
org.opencontainers.image.documentation="https://hub.docker.com/r/snowdreamtech/node" \
8+
org.opencontainers.image.base.name="snowdreamtech/node:alpine" \
99
org.opencontainers.image.licenses="MIT" \
10-
org.opencontainers.image.source="https://github.com/snowdreamtech/base" \
10+
org.opencontainers.image.source="https://github.com/snowdreamtech/node" \
1111
org.opencontainers.image.vendor="Snowdream Tech" \
12-
org.opencontainers.image.version="3.20.3" \
13-
org.opencontainers.image.url="https://github.com/snowdreamtech/base"
12+
org.opencontainers.image.version="20.15.1" \
13+
org.opencontainers.image.url="https://github.com/snowdreamtech/node"
1414

1515
# keep the docker container running
16-
ENV KEEPALIVE=1
16+
ENV KEEPALIVE=0 \
17+
NODEJS_VERSION=22.11.0-r0
18+
19+
ARG GID=1000 \
20+
UID=1000 \
21+
USER=node \
22+
WORKDIR=/home/node
23+
24+
# Create a user with UID and GID
25+
RUN if [ "${USER}" != "root" ]; then \
26+
addgroup -g ${GID} ${USER}; \
27+
adduser -h /home/${USER} -u ${UID} -g ${USER} -G ${USER} -s /bin/sh -D ${USER}; \
28+
# sed -i "/%sudo/c ${USER} ALL=(ALL:ALL) NOPASSWD:ALL" /etc/sudoers; \
29+
fi
1730

1831
RUN apk add --no-cache \
19-
vim
32+
nodejs=${NODEJS_VERSION}\
33+
npm \
34+
pnpm@community \
35+
yarn
36+
37+
# Switch to the user
38+
USER ${USER}
39+
40+
# Set the workdir
41+
WORKDIR ${WORKDIR}
2042

2143
COPY docker-entrypoint.sh /usr/local/bin/
2244

debian/Dockerfile

+37-8
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,58 @@ FROM snowdreamtech/debian:12.8.0
22

33
# OCI annotations to image
44
LABEL org.opencontainers.image.authors="Snowdream Tech" \
5-
org.opencontainers.image.title="Base Image Based On Debian" \
6-
org.opencontainers.image.description="Docker Images for Base on Debian. (i386,amd64,arm32v5,arm32v7,arm64,mips64le,ppc64le,s390x)" \
7-
org.opencontainers.image.documentation="https://hub.docker.com/r/snowdreamtech/base" \
8-
org.opencontainers.image.base.name="snowdreamtech/base:debian" \
5+
org.opencontainers.image.title="Node Image Noded On Debian" \
6+
org.opencontainers.image.description="Docker Images for Node on Debian. (i386,amd64,arm32v5,arm32v7,arm64,mips64le,ppc64le,s390x)" \
7+
org.opencontainers.image.documentation="https://hub.docker.com/r/snowdreamtech/node" \
8+
org.opencontainers.image.base.name="snowdreamtech/node:debian" \
99
org.opencontainers.image.licenses="MIT" \
10-
org.opencontainers.image.source="https://github.com/snowdreamtech/base" \
10+
org.opencontainers.image.source="https://github.com/snowdreamtech/node" \
1111
org.opencontainers.image.vendor="Snowdream Tech" \
1212
org.opencontainers.image.version="12.8" \
13-
org.opencontainers.image.url="https://github.com/snowdreamtech/base"
13+
org.opencontainers.image.url="https://github.com/snowdreamtech/node"
1414

1515
# keep the docker container running
16-
ENV KEEPALIVE=1
16+
ENV KEEPALIVE=1 \
17+
NODEJS_VERSION=18.19.0+dfsg-6~deb12u2
18+
19+
ARG GID=1000 \
20+
UID=1000 \
21+
USER=node \
22+
WORKDIR=/home/node
23+
24+
# Create a user with UID and GID
25+
RUN set -eux \
26+
&&if [ "${USER}" != "root" ]; then \
27+
addgroup --gid ${GID} ${USER}; \
28+
adduser --home /home/${USER} --uid ${UID} --gid ${GID} --gecos ${USER} --shell /bin/bash --disabled-password ${USER}; \
29+
# sed -i "/%sudo/c ${USER} ALL=(ALL:ALL) NOPASSWD:ALL" /etc/sudoers; \
30+
fi \
31+
&& apt-get -qqy --purge autoremove \
32+
&& apt-get -qqy clean \
33+
&& rm -rf /var/lib/apt/lists/* \
34+
&& rm -rf /tmp/* \
35+
&& rm -rf /var/tmp/*
1736

1837
RUN set -eux \
1938
&& apt-get -qqy update \
2039
&& apt-get -qqy install --no-install-recommends \
21-
vim \
40+
nodejs=${NODEJS_VERSION}\
41+
npm \
42+
yarnpkg \
43+
&& ln -s /usr/bin/yarnpkg /usr/bin/yarn \
44+
&& npm install -g pnpm \
2245
&& apt-get -qqy --purge autoremove \
2346
&& apt-get -qqy clean \
2447
&& rm -rf /var/lib/apt/lists/* \
2548
&& rm -rf /tmp/* \
2649
&& rm -rf /var/tmp/*
2750

51+
# Switch to the user
52+
USER ${USER}
53+
54+
# Set the workdir
55+
WORKDIR ${WORKDIR}
56+
2857
COPY docker-entrypoint.sh /usr/local/bin/
2958

3059
ENTRYPOINT ["docker-entrypoint.sh"]

0 commit comments

Comments
 (0)