Skip to content

Commit 5209a18

Browse files
committed
dev: Add Devcontainer environment
1 parent 821e5c2 commit 5209a18

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
FROM mcr.microsoft.com/devcontainers/ruby:2-3.4-trixie
2+
3+
# Install additional OS packages
4+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
5+
&& apt-get -y install --no-install-recommends \
6+
libssl-dev \
7+
libreadline-dev \
8+
zlib1g-dev \
9+
libncurses-dev \
10+
libyaml-dev \
11+
libffi-dev \
12+
libgdbm-dev \
13+
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
14+
15+
# Switch to vscode user
16+
USER vscode
17+
18+
# Install OpenSSL 1.1.1w locally
19+
RUN mkdir -p /home/vscode/.openssl_src \
20+
&& cd /home/vscode/.openssl_src \
21+
&& wget -q https://www.openssl.org/source/openssl-1.1.1w.tar.gz \
22+
&& tar -zxf openssl-1.1.1w.tar.gz \
23+
&& cd openssl-1.1.1w \
24+
&& ./config --prefix=/home/vscode/.openssl/1.1.1w --openssldir=/home/vscode/.openssl/1.1.1w \
25+
&& make \
26+
&& make install \
27+
&& cd .. \
28+
&& rm -rf /home/vscode/.openssl_src
29+
30+
# Link system certificates
31+
RUN rmdir /home/vscode/.openssl/1.1.1w/certs \
32+
&& ln -s /etc/ssl/certs /home/vscode/.openssl/1.1.1w/certs \
33+
&& ln -s /etc/ssl/certs/ca-certificates.crt /home/vscode/.openssl/1.1.1w/cert.pem
34+
35+
# Update RVM
36+
USER root
37+
SHELL ["/bin/bash", "-lc"]
38+
RUN curl -sSL https://rvm.io/mpapis.asc | gpg --import - \
39+
&& curl -sSL https://rvm.io/pkuczynski.asc | gpg --import - \
40+
&& rvm get master
41+
42+
# Install Rubies
43+
USER vscode
44+
RUN git config --global --add safe.directory /usr/local/rvm/repos/ruby
45+
ENV RUBY_CFLAGS="-Wno-error=implicit-function-declaration"
46+
RUN rvm install 2.7 --disable-binary --with-openssl-dir=/home/vscode/.openssl/1.1.1w
47+
RUN rvm install 3.0 --disable-binary --with-openssl-dir=/home/vscode/.openssl/1.1.1w
48+
RUN rvm install 3.1.6 --disable-binary
49+
RUN rvm install 3.2.4 --disable-binary
50+
RUN rvm install 3.3.1 --disable-binary

.devcontainer/devcontainer.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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/ruby
3+
{
4+
"name": "Ruby",
5+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6+
"build": {
7+
"dockerfile": "Dockerfile"
8+
},
9+
10+
// Features to add to the dev container. More info: https://containers.dev/features.
11+
"features": {
12+
"ghcr.io/devcontainers-extra/features/fish-apt-get:1": {},
13+
"ghcr.io/devcontainers-extra/features/neovim-apt-get:1": {},
14+
"ghcr.io/devcontainers-extra/features/ripgrep:1": {},
15+
"ghcr.io/schlich/devcontainer-features/jujutsu:0": {},
16+
"ghcr.io/stuartleeks/dev-container-features/shell-history:0": {}
17+
},
18+
"customizations": {
19+
"vscode": {
20+
"extensions": [
21+
"visualjj.visualjj"
22+
]
23+
}
24+
}
25+
26+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
27+
// "forwardPorts": [],
28+
29+
// Use 'postCreateCommand' to run commands after the container is created.
30+
// "postCreateCommand": "ruby --version",
31+
32+
// Configure tool-specific properties.
33+
// "customizations": {},
34+
35+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
36+
// "remoteUser": "root"
37+
}

0 commit comments

Comments
 (0)