Update devcontainer
The Ruby version got out of date at some point… here, I use `bin/rails devcontainer` as the newer, simpler base.
This commit is contained in:
parent
d72d358135
commit
d90e0549ca
13 changed files with 60 additions and 114 deletions
|
|
@ -1,15 +1,3 @@
|
|||
FROM mcr.microsoft.com/devcontainers/ruby:1-3.1-bullseye
|
||||
|
||||
# Default value to allow debug server to serve content over GitHub Codespace's port forwarding service
|
||||
# The value is a comma-separated list of allowed domains
|
||||
ENV RAILS_DEVELOPMENT_HOSTS=".githubpreview.dev,.preview.app.github.dev,.app.github.dev"
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
||||
|
||||
# [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
|
||||
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
|
||||
ARG RUBY_VERSION=3.4.5
|
||||
FROM ghcr.io/rails/devcontainer/images/ruby:$RUBY_VERSION
|
||||
|
|
|
|||
|
|
@ -1,29 +1,34 @@
|
|||
version: '3'
|
||||
name: "openneo_impress_items"
|
||||
|
||||
services:
|
||||
app:
|
||||
rails-app:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: .devcontainer/Dockerfile
|
||||
|
||||
volumes:
|
||||
- ../..:/workspaces:cached
|
||||
- ../..:/workspaces:cached
|
||||
|
||||
# Overrides default command so things don't shut down after the process ends.
|
||||
command: sleep infinity
|
||||
|
||||
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
|
||||
network_mode: service:db
|
||||
# Uncomment the next line to use a non-root user for all processes.
|
||||
# user: vscode
|
||||
|
||||
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
|
||||
# (Adding the "ports" property to this file will not forward from a Codespace.)
|
||||
depends_on:
|
||||
- mysql
|
||||
|
||||
db:
|
||||
image: mysql:latest
|
||||
mysql:
|
||||
image: mariadb:10.6
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./create-db.sql:/docker-entrypoint-initdb.d/create-db.sql
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: impress_dev
|
||||
MYSQL_USER: impress_dev
|
||||
MYSQL_PASSWORD: impress_dev
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: 'true'
|
||||
volumes:
|
||||
- mysql-data:/var/lib/mysql
|
||||
networks:
|
||||
- default
|
||||
|
||||
volumes:
|
||||
mysql-data:
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
CREATE DATABASE openneo_impress;
|
||||
GRANT ALL PRIVILEGES ON openneo_impress.* TO impress_dev;
|
||||
|
||||
CREATE DATABASE openneo_id;
|
||||
GRANT ALL PRIVILEGES ON openneo_id.* TO impress_dev;
|
||||
|
|
@ -1,46 +1,31 @@
|
|||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||
// README at: https://github.com/devcontainers/templates/tree/main/src/ruby-rails-postgres
|
||||
// For format details, see https://containers.dev/implementors/json_reference/.
|
||||
// For config options, see the README at: https://github.com/devcontainers/templates/tree/main/src/ruby
|
||||
{
|
||||
"name": "Dress to Impress",
|
||||
"dockerComposeFile": "docker-compose.yml",
|
||||
"service": "app",
|
||||
"name": "openneo_impress_items",
|
||||
"dockerComposeFile": "compose.yaml",
|
||||
"service": "rails-app",
|
||||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/node:1": {
|
||||
"nodeGypDependencies": true,
|
||||
"version": "lts"
|
||||
}
|
||||
},
|
||||
|
||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||
// "features": {},
|
||||
|
||||
// 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": [3000],
|
||||
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
"postCreateCommand": ".devcontainer/post-create.sh",
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/node:1": {},
|
||||
"ghcr.io/rails/devcontainer/features/mysql-client": {}
|
||||
},
|
||||
|
||||
"containerEnv": {
|
||||
// Because the database is hosted on the local network at the hostname `db`,
|
||||
// we partially override `config/database.yml` to connect to `db`!
|
||||
"DATABASE_URL_PRIMARY_DEV": "mysql2://db",
|
||||
"DATABASE_URL_OPENNEO_ID_DEV": "mysql2://db",
|
||||
"DATABASE_URL_PRIMARY_TEST": "mysql2://db",
|
||||
"DATABASE_URL_OPENNEO_ID_TEST": "mysql2://db",
|
||||
"DB_HOST": "mysql"
|
||||
},
|
||||
|
||||
// HACK: Out of the box, this dev container doesn't allow installation to
|
||||
// the default GEM_HOME, because of a weird thing going on with RVM.
|
||||
// Instead, we set a custom GEM_HOME and GEM_PATH in our home directory!
|
||||
// https://github.com/devcontainers/templates/issues/188
|
||||
"GEM_HOME": "~/.rubygems",
|
||||
"GEM_PATH": "~/.rubygems"
|
||||
}
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
"forwardPorts": [3000],
|
||||
|
||||
// Configure tool-specific properties.
|
||||
// "customizations": {},
|
||||
|
||||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||
// "remoteUser": "root"
|
||||
// Uncomment to connect as root instead. More info: https://containers.dev/implementors/json_reference/#remoteUser.
|
||||
// "remoteUser": "root",
|
||||
|
||||
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
"postCreateCommand": "bin/setup --skip-server"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e # Quit if any part of this script fails.
|
||||
|
||||
# Mark all git repositories as safe to execute, including cached gems.
|
||||
# NOTE: This would be dangerous to run on a normal multi-user machine,
|
||||
# but for a dev container that only we use, it should be fine!
|
||||
git config --global safe.directory '*'
|
||||
|
||||
# Install the app's Ruby gem dependencies.
|
||||
bundle install
|
||||
|
||||
# Set up the databases: create the schema, and load in some default data.
|
||||
bin/rails db:schema:load db:seed
|
||||
|
||||
# Install the app's JS dependencies.
|
||||
yarn install
|
||||
|
||||
# Run a first-time build of the app's JS, in development mode.
|
||||
yarn build:dev
|
||||
|
|
@ -1,9 +1,3 @@
|
|||
GIT
|
||||
remote: https://github.com/rubyamf/rocketamf.git
|
||||
revision: 796f591d002b5cf47df436dbcbd6f2ab00e869ed
|
||||
specs:
|
||||
RocketAMF (1.0.0)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
|
|
@ -533,7 +527,6 @@ PLATFORMS
|
|||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
RocketAMF!
|
||||
addressable (~> 2.8)
|
||||
async (~> 2.17)
|
||||
async-http (~> 0.89.0)
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
web: unset PORT && env RUBY_DEBUG_OPEN=true bin/rails server
|
||||
web: unset PORT && env RUBY_DEBUG_OPEN=true bin/rails server -b 0.0.0.0
|
||||
js: yarn dev
|
||||
|
|
|
|||
13
bin/setup
13
bin/setup
|
|
@ -12,7 +12,7 @@ FileUtils.chdir APP_ROOT do
|
|||
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
||||
# Add necessary setup steps to this file.
|
||||
|
||||
puts "== Installing dependencies =="
|
||||
puts "== Installing Ruby dependencies =="
|
||||
system("bundle check") || system!("bundle install")
|
||||
|
||||
# puts "\n== Copying sample files =="
|
||||
|
|
@ -23,6 +23,17 @@ FileUtils.chdir APP_ROOT do
|
|||
puts "\n== Preparing database =="
|
||||
system! "bin/rails db:prepare"
|
||||
|
||||
puts "\n== Importing public modeling data =="
|
||||
system! "bin/rails public_data:pull"
|
||||
|
||||
puts "\n== Installing Yarn dependencies =="
|
||||
system! "corepack enable"
|
||||
system! "corepack install"
|
||||
system! "yarn install"
|
||||
|
||||
puts "\n== Building development JS files =="
|
||||
system! "yarn build:dev"
|
||||
|
||||
puts "\n== Removing old logs and tempfiles =="
|
||||
system! "bin/rails log:clear tmp:clear"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
development:
|
||||
primary:
|
||||
# You can override these default settings with this environment variable,
|
||||
# fully or partially. We do this in the .devcontainer setup!
|
||||
url: <%= ENV['DATABASE_URL_PRIMARY_DEV'] %>
|
||||
adapter: mysql2
|
||||
host: <%= ENV.fetch("DB_HOST", "localhost") %>
|
||||
database: openneo_impress
|
||||
username: impress_dev
|
||||
password: impress_dev
|
||||
username: root
|
||||
pool: 5
|
||||
encoding: utf8mb4
|
||||
collation: utf8mb4_unicode_520_ci
|
||||
|
|
@ -14,13 +11,10 @@ development:
|
|||
sql_mode: TRADITIONAL
|
||||
|
||||
openneo_id:
|
||||
# You can override these default settings with this environment variable,
|
||||
# fully or partially. We do this in the .devcontainer setup!
|
||||
url: <%= ENV['DATABASE_URL_OPENNEO_ID_DEV'] %>
|
||||
adapter: mysql2
|
||||
host: <%= ENV.fetch("DB_HOST", "localhost") %>
|
||||
database: openneo_id
|
||||
username: impress_dev
|
||||
password: impress_dev
|
||||
username: root
|
||||
pool: 2
|
||||
variables:
|
||||
sql_mode: TRADITIONAL
|
||||
|
|
@ -28,13 +22,10 @@ development:
|
|||
|
||||
test:
|
||||
primary:
|
||||
# You can override these default settings with this environment variable,
|
||||
# fully or partially. We do this in the .devcontainer setup!
|
||||
url: <%= ENV['DATABASE_URL_PRIMARY_TEST'] %>
|
||||
adapter: mysql2
|
||||
host: <%= ENV.fetch("DB_HOST", "localhost") %>
|
||||
database: openneo_impress_test
|
||||
username: impress_dev
|
||||
password: impress_dev
|
||||
username: root
|
||||
pool: 5
|
||||
encoding: utf8mb4
|
||||
collation: utf8mb4_unicode_520_ci
|
||||
|
|
@ -42,13 +33,10 @@ test:
|
|||
sql_mode: TRADITIONAL
|
||||
|
||||
openneo_id:
|
||||
# You can override these default settings with this environment variable,
|
||||
# fully or partially. We do this in the .devcontainer setup!
|
||||
url: <%= ENV['DATABASE_URL_OPENNEO_ID_TEST'] %>
|
||||
adapter: mysql2
|
||||
host: <%= ENV.fetch("DB_HOST", "localhost") %>
|
||||
database: openneo_id_test
|
||||
username: impress_dev
|
||||
password: impress_dev
|
||||
username: root
|
||||
pool: 2
|
||||
variables:
|
||||
sql_mode: TRADITIONAL
|
||||
|
|
|
|||
BIN
vendor/cache/ffi-1.17.2-aarch64-linux-gnu.gem
vendored
Normal file
BIN
vendor/cache/ffi-1.17.2-aarch64-linux-gnu.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/ffi-1.17.2-arm64-darwin.gem
vendored
Normal file
BIN
vendor/cache/ffi-1.17.2-arm64-darwin.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/nokogiri-1.18.9-aarch64-linux-gnu.gem
vendored
Normal file
BIN
vendor/cache/nokogiri-1.18.9-aarch64-linux-gnu.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/nokogiri-1.18.9-arm64-darwin.gem
vendored
Normal file
BIN
vendor/cache/nokogiri-1.18.9-arm64-darwin.gem
vendored
Normal file
Binary file not shown.
Loading…
Reference in a new issue