Skip to content

Commit 7f8e0af

Browse files
committed
Use the Rails org ruby image in the Rails devcontainer
1 parent 5fcbc2c commit 7f8e0af

File tree

3 files changed

+15
-24
lines changed

3 files changed

+15
-24
lines changed

.devcontainer/Dockerfile

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,16 @@
11
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.191.1/containers/ruby/.devcontainer/base.Dockerfile
22

33
# [Choice] Ruby version: 3, 3.3, 3.2, 3.1, 3.0, 2, 2.7, 2.6
4-
ARG VARIANT="3.3"
5-
FROM mcr.microsoft.com/devcontainers/ruby:${VARIANT}
6-
7-
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
8-
ARG NODE_VERSION="lts/*"
9-
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
4+
ARG VARIANT="3.3.0"
5+
FROM ghcr.io/rails/devcontainer/images/ruby:${VARIANT}
106

117
# [Optional] Uncomment this section to install additional OS packages.
128
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
139
&& apt-get -y install --no-install-recommends \
1410
mariadb-client libmariadb-dev \
1511
postgresql-client postgresql-contrib libpq-dev \
16-
ffmpeg mupdf mupdf-tools libvips poppler-utils
17-
18-
19-
ARG IMAGEMAGICK_VERSION="7.1.0-5"
20-
RUN wget -qO /tmp/im.tar.xz https://imagemagick.org/archive/releases/ImageMagick-$IMAGEMAGICK_VERSION.tar.xz \
21-
&& wget -qO /tmp/im.sig https://imagemagick.org/archive/releases/ImageMagick-$IMAGEMAGICK_VERSION.tar.xz.asc \
22-
&& gpg --batch --keyserver keyserver.ubuntu.com --recv 89AB63D48277377A \
23-
&& gpg --batch --verify /tmp/im.sig /tmp/im.tar.xz \
24-
&& tar xJf /tmp/im.tar.xz -C /tmp \
25-
&& cd /tmp/ImageMagick-$IMAGEMAGICK_VERSION \
26-
&& ./configure --with-rsvg && make -j 9 && make install \
27-
&& ldconfig /usr/local/lib \
28-
&& rm -rf /tmp/*
12+
ffmpeg mupdf mupdf-tools libvips-dev poppler-utils \
13+
libxml2-dev sqlite3 imagemagick
2914

3015
# Add the Rails main Gemfile and install the gems. This means the gem install can be done
3116
# during build instead of on start. When a fork or branch has different gems, we still have an
@@ -44,8 +29,11 @@ COPY activerecord/activerecord.gemspec /tmp/rails/activerecord/
4429
COPY activestorage/activestorage.gemspec /tmp/rails/activestorage/
4530
COPY activesupport/activesupport.gemspec /tmp/rails/activesupport/
4631
COPY railties/railties.gemspec /tmp/rails/railties/
32+
# Docker does not support COPY as users other than root. So we need to chown this dir so we
33+
# can bundle as vscode user and then remove the tmp dir
34+
RUN chown -R vscode:vscode /tmp/rails
35+
USER vscode
4736
RUN cd /tmp/rails \
48-
&& bundle install \
49-
&& yarn install \
37+
&& /home/vscode/.rbenv/shims/bundle install \
5038
&& rm -rf /tmp/rails
51-
RUN chown -R vscode:vscode /usr/local/rvm
39+

.devcontainer/boot.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
bundle install
2-
yarn install
32

4-
sudo chown -R vscode:vscode /usr/local/bundle
3+
. ${NVM_DIR}/nvm.sh && nvm install --lts
4+
yarn install
55

66
cd activerecord
77

.devcontainer/devcontainer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
"features": {
1010
"ghcr.io/devcontainers/features/github-cli:1": {
1111
"version": "latest"
12+
},
13+
"ghcr.io/devcontainers/features/node:1": {
14+
"version": "latest"
1215
}
1316
},
1417

0 commit comments

Comments
 (0)