This application is pretty much a default Rails app. It has a single scaffold to show it works with a database, otherwise the intention is that it runs in Docker Compose and is setup for VSCode.
Open up folder in VSCode (currently need insiders edition!) with your project
a) Make sure you have the Remote Development plugin installed (https://code.visualstudio.com/blogs/2019/05/02/remote-development#_get-started) b) Make sure you have the Docker plugin (https://marketplace.visualstudio.com/items?itemName=PeterJausovec.vscode-docker)
i) Run docker-compose -f .devcontainer/docker-compose.yml build
ii) Run docker-compose -f .devcontainer/docker-compose.yml up
VSCode can automatically handle things if the folder you open has a devcontainer.json
or .devcontainer/devcontainer.json
. It can handle docker-compose
too, which is setup in this demo.
Open up the folder, then open the Docker extension. Right click on the web container, and click "Attach Visual Studio Code".
5) Open https://localhost:3000
This might take 20-30 seconds to boot.
Add this snippet to your ~/.bash_profile (or zsh, etc) to automatically enable a COMPOSE_FILE
variable, so you don't need to specify the -f ...
option on the docker-compose
commands.
docker_compose() {
if [[ -f ".devcontainer/docker-compose.yml" ]] && [[ ! -f "docker-compose.yml" ]]; then
export COMPOSE_FILE=".devcontainer/docker-compose.yml"
else
unset COMPOSE_FILE
fi
}
trap 'docker_compose' DEBUG