Skip to content

Commit

Permalink
Update Dockerfile to use MSFT's Ruby Dev Container image
Browse files Browse the repository at this point in the history
  • Loading branch information
tarebyte committed Aug 6, 2023
1 parent 51968c1 commit 1894cc6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 35 deletions.
35 changes: 9 additions & 26 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
FROM mcr.microsoft.com/devcontainers/base:jammy
ARG RUBY_VERSION

ENV DEBIAN_FRONTEND noninteractive
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
FROM mcr.microsoft.com/devcontainers/ruby:${RUBY_VERSION}

# disable installing recommended packages to save space
RUN echo "APT::Install-Recommends \"false\";" > /etc/apt/apt.conf
ARG NODE_VERSION
RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"

RUN apt-get update && \
export DEBIAN_FRONTEND=noninteractive && \
apt-get upgrade -y && \
apt-get install -y \
build-essential \
libffi-dev \
libjemalloc-dev \
apt-get install -y --no-install-recommends \
libpq-dev \
libreadline-dev \
libssl-dev \
libxml2-dev \
libxslt-dev \
libyaml-dev \
python2 \
shared-mime-info \
tmux \
zlib1g-dev && \
tmux && \
apt-get autoremove -y

# Install Overmind to run multiple processes at once.
Expand All @@ -31,16 +22,8 @@ RUN curl --fail --location --output /usr/bin/overmind.gz "https://github.com/Dar
gunzip /usr/bin/overmind.gz && \
chmod +x /usr/bin/overmind

# Run as the target user
# Uses the username created by the VSCode devcontainer Ubuntu base image
USER vscode
ENV USER=vscode

COPY ../.ruby-version /tmp/.ruby-version

RUN git clone https://github.com/rbenv/rbenv.git ~/.rbenv
RUN git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
RUN ~/.rbenv/bin/rbenv install $(cat /tmp/.ruby-version)
RUN su vscode -c "gem install bundler:2.4.18"
RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g yarn" 2>&1

ENV OVERMIND_SOCKET=/tmp/.overmind.sock

Expand Down
3 changes: 0 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@
"ghcr.io/devcontainers/features/sshd:1": {
"version": "latest"
},
"ghcr.io/devcontainers/features/node:1": {
"version": "10.13"
},
"ghcr.io/devcontainers-contrib/features/zsh-plugins:0": {
"plugins": "git npm nvm rbenv ssh-agent zsh-autosuggestions",
"omzPlugins": "https://github.com/zsh-users/zsh-autosuggestions"
Expand Down
3 changes: 3 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ services:
build:
context: .
dockerfile: .devcontainer/Dockerfile
args:
RUBY_VERSION: 2.7
NODE_VERSION: 10.13

environment:
DATABASE_HOST: postgres
Expand Down
6 changes: 0 additions & 6 deletions .devcontainer/post-create-command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,4 @@ GOOGLE_ANALYTICS_ID="..."
EOT
fi

gem update bundler
rbenv rehash

npm update -g npm
npm install -g yarn

./bin/setup

0 comments on commit 1894cc6

Please sign in to comment.