From fadb5de0e4c325db75c379ee2fc6098b8029d404 Mon Sep 17 00:00:00 2001 From: Brian Morton Date: Fri, 14 Feb 2025 23:07:15 -0800 Subject: [PATCH] Add devcontainer setup --- .devcontainer/Dockerfile | 3 ++ .devcontainer/boot | 9 ++++++ .devcontainer/devcontainer.json | 50 ++++++++++++++++++++++++++++++++ .devcontainer/docker-compose.yml | 8 +++++ 4 files changed, 70 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100755 .devcontainer/boot create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/docker-compose.yml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..e4c2042 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,3 @@ +FROM mcr.microsoft.com/vscode/devcontainers/base:ubuntu-24.04 + +RUN apt install curl ca-certificates git diff --git a/.devcontainer/boot b/.devcontainer/boot new file mode 100755 index 0000000..52d566b --- /dev/null +++ b/.devcontainer/boot @@ -0,0 +1,9 @@ +#!/bin/bash + +echo "Updating RubyGems..." +gem update --system -N + +echo "Installing dependencies..." +bundle install + +echo "Done!" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..974f8b9 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,50 @@ +{ + "name": "Ruby development", + "dockerComposeFile": "docker-compose.yml", + "service": "app", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + "features": { + "ghcr.io/devcontainers/features/github-cli:1": {}, + "ghcr.io/devcontainers/features/common-utils:2": { + "username": "vscode", + "userUid": 1001, + "userGid": 1001, + "installZsh": true, + "installOhMyZsh": true, + "configureZshAsDefaultShell": true, + "upgradePackages": true + }, + "ghcr.io/rocker-org/devcontainer-features/apt-packages:1": { + "packages": "libpq-dev, libvips" + }, + "ghcr.io/devcontainers/features/ruby:1": { + "version": "3.4.1" + }, + "ghcr.io/devcontainers/features/node:1": {}, + "ghcr.io/devcontainers-extra/features/zsh-plugins:0": { + "username": "vscode", + "plugins": "bundler rails ruby yarn git" + }, + "ghcr.io/devcontainers/features/sshd:1": { + "version": "latest" + } + }, + + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": ["Shopify.ruby-lsp", "EditorConfig.EditorConfig"] + } + }, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // This can be used to network with other containers or the host. + "forwardPorts": [5433], + + "postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": ".devcontainer/boot", + + "remoteUser": "vscode" +} diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 0000000..ae967db --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,8 @@ +services: + app: + build: + context: .. + dockerfile: .devcontainer/Dockerfile + volumes: + - ../..:/workspaces:cached + command: sleep infinity