Skip to content

Commit 576139a

Browse files
committed
adding docker test Ghost scenario
1 parent ae0f1e4 commit 576139a

5 files changed

Lines changed: 70 additions & 2 deletions

File tree

docs/DOCKER_TESTING.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
| Scenario | System Node | Version Manager | Managed Node | Status |
66
|----------|-------------|-----------------|--------------|--------|
77
| **node8-system** | 8.17.0 | None | - | ✅ Working |
8+
| **node8-ghost** | 8.17.0 | None | - | ✅ Working |
89
| **node10-volta-node12** | 10.x | Volta | 12.22.12 | ✅ Working |
910
| **node12-nvm-node14** | 12.x | NVM | 14.21.3 | ✅ Working |
1011
| **node13-system** | 13.14.0 | None | - | ✅ Working |
@@ -45,10 +46,14 @@ test/docker/
4546

4647
### Build All Scenarios
4748
```bash
48-
cd /home/edsadr/NodeSource/ns-upgrade
4949
./test/docker/scripts/build-all.sh
5050
```
5151

52+
### Build a Single Scenario
53+
```bash
54+
./test/docker/scripts/build-all.sh <scenario-name>
55+
```
56+
5257
### Test a Scenario
5358
```bash
5459
./test/docker/scripts/test-scenario-interactive.sh <scenario-name>

test/docker/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Test the ns-upgrade CLI across different Node.js environments.
99
| Scenario | System Node | Version Manager | Managed Node | Status |
1010
|----------|-------------|-----------------|--------------|--------|
1111
| **node8-system** | 8.17.0 | None | - | ✅ Ready |
12+
| **node8-ghost** | 8.17.0 | None | - | ✅ Ready |
1213
| **node10-volta-node12** | 10.x | Volta | 12.22.12 | ✅ Ready |
1314
| **node12-nvm-node14** | 12.x | NVM | 14.21.3 | ✅ Ready |
1415
| **node13-system** | 13.14.0 | None | - | ✅ Ready |
@@ -145,7 +146,7 @@ Use the interactive script:
145146

146147
Ensure you're in the project root:
147148
```bash
148-
cd /home/edsadr/NodeSource/ns-upgrade
149+
cd ~/NodeSource/ns-upgrade
149150
```
150151

151152
### Build failures
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Use the base image with Node 22 and ns-upgrade pre-installed
2+
FROM ns-upgrade-test-base:latest
3+
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
6+
# Install Node.js 8.17.0 from binary
7+
RUN curl -fsSL https://nodejs.org/dist/v8.17.0/node-v8.17.0-linux-x64.tar.xz -o /tmp/node.tar.xz && \
8+
tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1 && \
9+
rm /tmp/node.tar.xz
10+
11+
# Verify Node.js 8 installation
12+
RUN node --version && npm --version && \
13+
echo "✓ Node 8 installed as system Node"
14+
15+
# Install build dependencies for native modules (sqlite3, etc.)
16+
# Python 2 is usually required for Node 8 native modules
17+
RUN apt-get update && apt-get install -y \
18+
python \
19+
make \
20+
g++ \
21+
&& rm -rf /var/lib/apt/lists/*
22+
23+
# Download Ghost v1.25.5
24+
WORKDIR /workspace/ghost
25+
# Download Ghost v1.25.5 with submodules (needed for default theme)
26+
WORKDIR /workspace/ghost
27+
RUN git clone --recurse-submodules --branch 1.25.5 https://github.com/TryGhost/Ghost.git .
28+
29+
# Install Yarn and knex-migrator globally
30+
RUN npm install -g yarn knex-migrator
31+
32+
# Install Ghost dependencies and run setup
33+
# --unsafe-perm is often needed when running as root
34+
RUN echo "Installing Ghost dependencies with Yarn" && \
35+
yarn setup
36+
37+
# Verify complete environment
38+
RUN node --version && \
39+
/opt/node22/bin/node --version && \
40+
echo "✓ System Node 8, Node 22 at /opt/node22 for CLI"
41+
42+
# Set environment variables
43+
ENV SCENARIO_NAME=node8-ghost
44+
ENV VERSION_MANAGER=none
45+
ENV server__host=0.0.0.0
46+
ENV server__port=2368
47+
48+
# Default: show info and instructions
49+
EXPOSE 2368
50+
CMD ["/workspace/info.sh"]

test/docker/scripts/build-all.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,19 @@ cd "$PROJECT_ROOT"
1717

1818
SCENARIOS=(
1919
"node8-system"
20+
"node8-ghost"
2021
"node12-nvm-node14"
2122
"node13-system"
2223
"node10-volta-node12"
2324
"node16-fnm-node18"
2425
"node20-system"
2526
)
2627

28+
# Allow building specific scenarios passed as arguments
29+
if [ "$#" -gt 0 ]; then
30+
SCENARIOS=("$@")
31+
fi
32+
2733
# Build base image first
2834
echo "🔨 Building base image..."
2935
docker build -t ns-upgrade-test-base -f test/docker/base/Dockerfile.base .

test/docker/scripts/test-scenario-interactive.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,14 @@ mkdir -p "$PROJECT_ROOT/test/docker/results"
5151

5252
# Run container with interactive TTY
5353
# First show info, then drop into bash shell
54+
DOCKER_ARGS=""
55+
if [ "$SCENARIO" == "node8-ghost" ]; then
56+
DOCKER_ARGS="-p 2368:2368"
57+
fi
58+
5459
docker run -it --rm \
5560
-v "$PROJECT_ROOT/test/docker/results:/results" \
61+
$DOCKER_ARGS \
5662
"ns-upgrade-test-$SCENARIO" \
5763
/bin/bash -c "/workspace/info.sh && exec /bin/bash"
5864

0 commit comments

Comments
 (0)