Skip to content
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
57 changes: 56 additions & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,60 @@ Install [Container Structure Test](https://github.com/GoogleContainerTools/conta


```bash
container-structure-test test --image meghsh/php:8.2 --config structure-test.yaml
container-structure-test test --image meghsh/php:8.2 --config php-structure-test.yaml
```

### Node.js (Alpine)

Docker images for Node.js (Alpine variant), including `yarn`, `pnpm`, and `vite`.

#### Supported Versions

- Node 18
- Node 20
- Node 22
- Node 24
- Node 25

### Getting the images

```bash
# Node 25 (Latest)
docker image pull meghsh/node:25

# Node 22 (LTS)
docker image pull meghsh/node:22
```

### Using the images

One-off commands:

```bash
docker run --rm meghsh/node:25 node -v
docker run --rm meghsh/node:25 yarn -v
docker run --rm meghsh/node:25 pnpm -v
```

With docker-compose:

```yaml
services:
node:
image: "meghsh/node:25"
volumes:
- "./app:/var/www/html"
command: npm run dev
```

### Testing Node.js Images

To verify the Node.js image structure and installed tools:

```bash
# Build the image locally (optional, if testing changes)
./node/build.sh

# Run structure tests
container-structure-test test --image meghsh/node:25 --config node-structure-test.yaml
```
28 changes: 28 additions & 0 deletions node-structure-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
schemaVersion: '2.0.0'

commandTests:
- name: "Node is installed"
command: "node"
args: ["-v"]
expectedOutput: ["v"]

- name: "Yarn is installed"
command: "yarn"
args: ["-v"]
# expectedOutput: ["1."] # Yarn version might vary, just checking it runs

- name: "PNPM is installed"
command: "pnpm"
args: ["-v"]

- name: "Vite is installed"
command: "vite"
args: ["-v"]
expectedOutput: ["vite"]

- name: "Git is installed"
command: "git"
args: ["--version"]
expectedOutput: ["git version"]


10 changes: 10 additions & 0 deletions node/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ARG NODE_VERSION=18
FROM node:${NODE_VERSION}-alpine

# Install system dependencies
RUN apk add --no-cache git bash

# Install global packages and clean cache
RUN npm install -g yarn pnpm vite --force && npm cache clean --force

CMD ["node"]
18 changes: 18 additions & 0 deletions node/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

export DOCKER_BUILDKIT=1

# Build for Node 18
docker buildx build --platform linux/amd64,linux/arm64 --build-arg NODE_VERSION=18 -t meghsh/node:18 -f node/Dockerfile node --push

# Build for Node 20
docker buildx build --platform linux/amd64,linux/arm64 --build-arg NODE_VERSION=20 -t meghsh/node:20 -f node/Dockerfile node --push

# Build for Node 22
docker buildx build --platform linux/amd64,linux/arm64 --build-arg NODE_VERSION=22 -t meghsh/node:22 -f node/Dockerfile node --push

# Build for Node 24
docker buildx build --platform linux/amd64,linux/arm64 --build-arg NODE_VERSION=24 -t meghsh/node:24 -f node/Dockerfile node --push

# Build for Node 25
docker buildx build --platform linux/amd64,linux/arm64 --build-arg NODE_VERSION=25 -t meghsh/node:25 -f node/Dockerfile node --push
Loading