mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Github Codespaces configuration
This commit is contained in:
parent
e9f38a164e
commit
6e7a376b00
3 changed files with 78 additions and 0 deletions
24
.devcontainer/Dockerfile
Normal file
24
.devcontainer/Dockerfile
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.191.1/containers/ruby/.devcontainer/base.Dockerfile
|
||||||
|
|
||||||
|
# [Choice] Ruby version: 3, 3.0, 2, 2.7, 2.6
|
||||||
|
ARG VARIANT="3.0"
|
||||||
|
FROM mcr.microsoft.com/vscode/devcontainers/ruby:0-${VARIANT}
|
||||||
|
|
||||||
|
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
|
||||||
|
ARG NODE_VERSION="none"
|
||||||
|
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||||
|
|
||||||
|
# [Optional] Uncomment this section to install additional OS packages.
|
||||||
|
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||||
|
&& apt-get -y install --no-install-recommends \
|
||||||
|
mariadb-server libmariadbclient-dev \
|
||||||
|
postgresql postgresql-client postgresql-contrib libpq-dev \
|
||||||
|
redis-server memcached \
|
||||||
|
imagemagick ffmpeg mupdf mupdf-tools libvips
|
||||||
|
|
||||||
|
|
||||||
|
# [Optional] Uncomment this line to install additional gems.
|
||||||
|
# RUN gem install <your-gem-names-here>
|
||||||
|
|
||||||
|
# [Optional] Uncomment this line to install global node packages.
|
||||||
|
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
|
22
.devcontainer/boot.sh
Executable file
22
.devcontainer/boot.sh
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
bundle install
|
||||||
|
yarn install
|
||||||
|
|
||||||
|
sudo service postgresql start
|
||||||
|
sudo service mysql start
|
||||||
|
sudo service redis-server start
|
||||||
|
sudo service memcached start
|
||||||
|
|
||||||
|
# Create PostgreSQL users and databases
|
||||||
|
sudo su postgres -c "createuser --superuser vscode"
|
||||||
|
sudo su postgres -c "createdb -O vscode -E UTF8 -T template0 activerecord_unittest"
|
||||||
|
sudo su postgres -c "createdb -O vscode -E UTF8 -T template0 activerecord_unittest2"
|
||||||
|
|
||||||
|
# Create MySQL database and databases
|
||||||
|
MYSQL_PWD=root sudo mysql -uroot <<SQL
|
||||||
|
CREATE USER 'rails'@'localhost';
|
||||||
|
CREATE DATABASE activerecord_unittest DEFAULT CHARACTER SET utf8mb4;
|
||||||
|
CREATE DATABASE activerecord_unittest2 DEFAULT CHARACTER SET utf8mb4;
|
||||||
|
GRANT ALL PRIVILEGES ON activerecord_unittest.* to 'rails'@'localhost';
|
||||||
|
GRANT ALL PRIVILEGES ON activerecord_unittest2.* to 'rails'@'localhost';
|
||||||
|
GRANT ALL PRIVILEGES ON inexistent_activerecord_unittest.* to 'rails'@'localhost';
|
||||||
|
SQL
|
32
.devcontainer/devcontainer.json
Normal file
32
.devcontainer/devcontainer.json
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
||||||
|
// https://github.com/microsoft/vscode-dev-containers/tree/v0.191.1/containers/ruby
|
||||||
|
{
|
||||||
|
"name": "Ruby",
|
||||||
|
"build": {
|
||||||
|
"dockerfile": "Dockerfile",
|
||||||
|
"args": {
|
||||||
|
// Update 'VARIANT' to pick a Ruby version: 3, 3.0, 2, 2.7, 2.6
|
||||||
|
"VARIANT": "3",
|
||||||
|
// Options
|
||||||
|
"NODE_VERSION": "lts/*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// Set *default* container specific settings.json values on container create.
|
||||||
|
"settings": {},
|
||||||
|
|
||||||
|
// Add the IDs of extensions you want installed when the container is created.
|
||||||
|
"extensions": [
|
||||||
|
"rebornix.Ruby"
|
||||||
|
],
|
||||||
|
|
||||||
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
|
// "forwardPorts": [],
|
||||||
|
|
||||||
|
// Use 'postCreateCommand' to run commands after the container is created.
|
||||||
|
"postCreateCommand": ".devcontainer/boot.sh",
|
||||||
|
|
||||||
|
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||||
|
"remoteUser": "vscode"
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue