Skip to content

Commit ab23923

Browse files
committed
Add a script to build the Ruby image and test locally
1 parent 11eb84e commit ab23923

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

.devcontainer/devcontainer.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-in-docker
3+
{
4+
"name": "Docker in Docker",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"image": "mcr.microsoft.com/devcontainers/javascript-node:0-18",
7+
8+
"features": {
9+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
10+
"version": "latest",
11+
"enableNonRootDocker": "true",
12+
"moby": "true"
13+
}
14+
},
15+
16+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
17+
// "forwardPorts": [],
18+
19+
// Use 'postCreateCommand' to run commands after the container is created.
20+
"postCreateCommand": "npm install -g @devcontainers/cli"
21+
22+
// Configure tool-specific properties.
23+
// "customizations": {},
24+
25+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
26+
// "remoteUser": "root"
27+
}

bin/build-image

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
# Check if Ruby version is provided
4+
if [ -z "$1" ]; then
5+
echo "Usage: $0 <ruby-version>"
6+
exit 1
7+
fi
8+
9+
RUBY_VERSION=$1
10+
11+
devcontainer build --workspace-folder images/ruby --image-name ghcr.io/rails/devcontainer/images/ruby:$RUBY_VERSION --output /tmp/output.tar

0 commit comments

Comments
 (0)