Skip to content

Commit b4ac3e9

Browse files
committed
Added devcontainer manifest
1 parent 02acd51 commit b4ac3e9

File tree

4 files changed

+72
-1
lines changed

4 files changed

+72
-1
lines changed

.devcontainer/Dockerfile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Use the official Ruby image as base
2+
FROM ruby:3.3-slim
3+
4+
# Install system dependencies
5+
RUN apt-get update -qq && apt-get install -y \
6+
build-essential \
7+
git \
8+
curl \
9+
sqlite3 \
10+
libsqlite3-dev \
11+
libyaml-dev \
12+
&& rm -rf /var/lib/apt/lists/*
13+
14+
# Install Node.js (for documentation site)
15+
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
16+
&& apt-get install -y nodejs
17+
18+
# Create a non-root user
19+
RUN groupadd --gid 1000 user \
20+
&& useradd --uid 1000 --gid user --shell /bin/bash --create-home user
21+
22+
# Set up the working directory
23+
WORKDIR /workspace
24+
25+
# Install bundler
26+
RUN gem install bundler
27+
28+
# Create cache directory for gems
29+
RUN mkdir -p /usr/local/bundle && chown -R user:user /usr/local/bundle
30+
31+
# Switch to non-root user
32+
USER user
33+
34+
# Set up git config (helps with development)
35+
RUN git config --global init.defaultBranch main
36+
37+
# Set the default shell
38+
SHELL ["/bin/bash", "-c"]

.devcontainer/devcontainer.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "Inertia Rails Development",
3+
"dockerComposeFile": "docker-compose.yml",
4+
"service": "app",
5+
"workspaceFolder": "/workspace",
6+
"customizations": {
7+
"vscode": {
8+
"extensions": [
9+
"shopify.ruby-lsp",
10+
"ms-vscode.vscode-json",
11+
"redhat.vscode-yaml"
12+
]
13+
}
14+
},
15+
"forwardPorts": [3000, 5173],
16+
"postCreateCommand": "bin/setup",
17+
"remoteUser": "user"
18+
}

.devcontainer/docker-compose.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
services:
2+
app:
3+
build:
4+
context: ..
5+
dockerfile: .devcontainer/Dockerfile
6+
volumes:
7+
- ..:/workspace:cached
8+
- gem_cache:/usr/local/bundle
9+
command: sleep infinity
10+
environment:
11+
- RAILS_ENV=development
12+
working_dir: /workspace
13+
14+
volumes:
15+
gem_cache:

spec/rails_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Requiring logger fixes an issue between concurrent-ruby and activesupport in Rails < 7.1
33
# https://github.com/rails/rails/issues/54260
44
require 'logger'
5-
ENV['RAILS_ENV'] ||= 'test'
5+
ENV['RAILS_ENV'] = 'test'
66

77
require File.expand_path('../dummy/config/environment', __FILE__)
88

0 commit comments

Comments
 (0)